cleanup and add translation hooks
This commit is contained in:
@@ -54,7 +54,7 @@ end
|
|||||||
group :test do
|
group :test do
|
||||||
gem 'rspec-rails'
|
gem 'rspec-rails'
|
||||||
#gem 'minitest'
|
#gem 'minitest'
|
||||||
gem 'turn', :require => false
|
gem 'pry'
|
||||||
gem 'factory_girl_rails'
|
gem 'factory_girl_rails'
|
||||||
gem 'selenium-webdriver' #, '2.21.1' # 2.21.2 gives trouble, remove this line when this is solved since this is a dependency of capybara
|
gem 'selenium-webdriver' #, '2.21.1' # 2.21.2 gives trouble, remove this line when this is solved since this is a dependency of capybara
|
||||||
gem 'capybara'
|
gem 'capybara'
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ GEM
|
|||||||
activesupport (3.2.9)
|
activesupport (3.2.9)
|
||||||
i18n (~> 0.6)
|
i18n (~> 0.6)
|
||||||
multi_json (~> 1.0)
|
multi_json (~> 1.0)
|
||||||
ansi (1.4.3)
|
|
||||||
arel (3.0.2)
|
arel (3.0.2)
|
||||||
bcrypt-ruby (3.0.1)
|
bcrypt-ruby (3.0.1)
|
||||||
builder (3.0.4)
|
builder (3.0.4)
|
||||||
@@ -225,8 +224,6 @@ GEM
|
|||||||
treetop (1.4.12)
|
treetop (1.4.12)
|
||||||
polyglot
|
polyglot
|
||||||
polyglot (>= 0.3.1)
|
polyglot (>= 0.3.1)
|
||||||
turn (0.9.6)
|
|
||||||
ansi
|
|
||||||
twitter-bootstrap-rails (2.1.6)
|
twitter-bootstrap-rails (2.1.6)
|
||||||
actionpack (>= 3.1)
|
actionpack (>= 3.1)
|
||||||
execjs
|
execjs
|
||||||
@@ -270,6 +267,5 @@ DEPENDENCIES
|
|||||||
slim-rails
|
slim-rails
|
||||||
therubyracer
|
therubyracer
|
||||||
thin
|
thin
|
||||||
turn
|
|
||||||
twitter-bootstrap-rails
|
twitter-bootstrap-rails
|
||||||
uglifier (>= 1.0.3)
|
uglifier (>= 1.0.3)
|
||||||
|
|||||||
@@ -77,4 +77,20 @@ module ApplicationHelper
|
|||||||
link_to 'Twitter', 'https://www.twitter.com/Qwaiter', target: :_blank
|
link_to 'Twitter', 'https://www.twitter.com/Qwaiter', target: :_blank
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Add a script call to be executed when the dom is loaded.
|
||||||
|
# When called without a script it will return the total added script content
|
||||||
|
# - onload_javascript 'var a=1'
|
||||||
|
# - onload_javascript 'var b=3'
|
||||||
|
# = onload_javascript #=> var a=1;var b=3
|
||||||
|
def onload_javascript(script = nil)
|
||||||
|
if block_given?
|
||||||
|
script = script.to_s
|
||||||
|
value = nil
|
||||||
|
buffer = with_output_buffer { value = yield }
|
||||||
|
script += (buffer.presence || value).to_s
|
||||||
|
end
|
||||||
|
script = script.call if script.respond_to?(:call)
|
||||||
|
script.present? ? (@onload_javascripts ||= []) << script : (@onload_javascripts || []).join(';')
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ html lang="en"
|
|||||||
link href="/favicon.ico" rel="shortcut icon"
|
link href="/favicon.ico" rel="shortcut icon"
|
||||||
javascript:
|
javascript:
|
||||||
var data_host = '#{Rails.env == 'development' ? 'http://qwaiter.dev' : 'http://data.qwaiter.com' }';
|
var data_host = '#{Rails.env == 'development' ? 'http://qwaiter.dev' : 'http://data.qwaiter.com' }';
|
||||||
var data_host = 'http://localhost:3000';
|
//var data_host = 'http://localhost:3000';
|
||||||
var event_host = '#{event_host}';
|
var event_host = '#{event_host}';
|
||||||
//data_host = 'http://192.168.1.148:3000';
|
//data_host = 'http://192.168.1.148:3000';
|
||||||
var $locale = 'en';
|
var $locale = 'en';
|
||||||
@@ -80,3 +80,5 @@ html lang="en"
|
|||||||
/ Placed at the end of the document so the pages load faster
|
/ Placed at the end of the document so the pages load faster
|
||||||
= javascript_include_tag "user/application"
|
= javascript_include_tag "user/application"
|
||||||
= yield :footer
|
= yield :footer
|
||||||
|
javascript:
|
||||||
|
jQuery(function(){#{onload_javascript}});
|
||||||
|
|||||||
@@ -1,25 +1,22 @@
|
|||||||
.page-header= title t('user.history_list.title', list: List.model_name.human)
|
.page-header
|
||||||
|
h1.page-title data-t="history_list.title" = t('user.history_list.title', list: List.model_name.human)
|
||||||
dl.dl-horizontal
|
dl.dl-horizontal
|
||||||
dt= List.human_attribute_name(:created_at)
|
dt data-t="attributes.list.created_at" = List.human_attribute_name(:created_at)
|
||||||
dd.list-created-at
|
dd.list-created-at
|
||||||
dt= List.human_attribute_name(:closed_at)
|
dt data-t="attributes.list.closed_at" = List.human_attribute_name(:closed_at)
|
||||||
dd.list-closed-at
|
dd.list-closed-at
|
||||||
dt= Supplier.model_name.human
|
dt data-t="models.supplier" = Supplier.model_name.human
|
||||||
dd.supplier-name
|
dd.supplier-name
|
||||||
.well
|
.well
|
||||||
table#history-list-table.table.list-table
|
table#history-list-table.table.list-table
|
||||||
thead
|
thead
|
||||||
tr
|
tr
|
||||||
th= Order.model_name.human
|
th data-t="models.order" = Order.model_name.human
|
||||||
th.currency= Product.human_attribute_name(:price)
|
th.currency data-t="attributes.product.price" = Product.human_attribute_name(:price)
|
||||||
tbody
|
tbody
|
||||||
tr
|
tr
|
||||||
td colspan=2 = slider_image
|
td colspan=2 = slider_image
|
||||||
tfoot
|
tfoot
|
||||||
script#active-list-order-template[type="text/html"]= render 'active_list_order.mustache'
|
script#active-list-order-template[type="text/html"]= render 'active_list_order.mustache'
|
||||||
script#active-list-orders-footer-template[type="text/html"]= render 'active_list_orders_footer.mustache'
|
script#active-list-orders-footer-template[type="text/html"]= render 'active_list_orders_footer.mustache'
|
||||||
- content_for :footer do
|
- onload_javascript "Quser.load_history_list()"
|
||||||
javascript:
|
|
||||||
jQuery(function(){
|
|
||||||
Quser.load_history_list();
|
|
||||||
})
|
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
.page-header
|
.page-header
|
||||||
h2 data-t="list_history.title" = t('user.list_history.title')
|
h1 data-t="list_history.title" = t('user.list_history.title')
|
||||||
nav.pagination
|
nav.pagination
|
||||||
ul#list-history-container
|
ul#list-history-container
|
||||||
- content_for :footer do
|
- onload_javascript "Quser.load_list_history()"
|
||||||
javascript:
|
|
||||||
$(function(){
|
|
||||||
Quser.load_list_history();
|
|
||||||
});
|
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
# Specs in this file have access to a helper object that includes
|
||||||
|
# the ApplicationHelper. For example:
|
||||||
|
#
|
||||||
|
# describe ApplicationHelper do
|
||||||
|
# describe "string concat" do
|
||||||
|
# it "concats two strings with spaces" do
|
||||||
|
# helper.concat_strings("this","that").should == "this that"
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
describe ApplicationHelper do
|
||||||
|
describe "onload_javascript" do
|
||||||
|
it "should add a normal string when given" do
|
||||||
|
onload_javascript "alert('hi')"
|
||||||
|
onload_javascript.should == "alert('hi')"
|
||||||
|
end
|
||||||
|
it "should concatenate separate statements correctly" do
|
||||||
|
onload_javascript "alert('hi')"
|
||||||
|
onload_javascript "alert('ho')"
|
||||||
|
onload_javascript.should == "alert('hi');alert('ho')"
|
||||||
|
end
|
||||||
|
it "should accept a block as argument" do
|
||||||
|
onload_javascript do
|
||||||
|
"alert('hi')"
|
||||||
|
end
|
||||||
|
onload_javascript.should == "alert('hi')"
|
||||||
|
end
|
||||||
|
it "should accept a lambda as argument" do
|
||||||
|
onload_javascript ->{ "alert('hi')" }
|
||||||
|
onload_javascript.should == "alert('hi')"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
require 'spec_helper'
|
|
||||||
|
|
||||||
# Specs in this file have access to a helper object that includes
|
|
||||||
# the UsersHelper. For example:
|
|
||||||
#
|
|
||||||
# describe UsersHelper do
|
|
||||||
# describe "string concat" do
|
|
||||||
# it "concats two strings with spaces" do
|
|
||||||
# helper.concat_strings("this","that").should == "this that"
|
|
||||||
# end
|
|
||||||
# end
|
|
||||||
# end
|
|
||||||
describe UsersHelper do
|
|
||||||
pending "add some examples to (or delete) #{__FILE__}"
|
|
||||||
end
|
|
||||||
Reference in New Issue
Block a user