gaku_frontend 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 23b7a503f4fff6f766d3ce5fc0d4838670ee7b47
4
- data.tar.gz: 0b077bf6dc3c9411ad2d79aa98f4c5cfcb823cfb
3
+ metadata.gz: de0b5133f209bcec14995e2ec091d518e11e7882
4
+ data.tar.gz: 18eb6ce2a8b00963e7abfe195e283011bab34500
5
5
  SHA512:
6
- metadata.gz: 2c54ee01cb05f1518b17898e18c12e13e4370d1d8a47abd3ff5b2b31a2008d5e0e5bd9b30fb0932447049cce6b8a43569d635ceac335549e275212935fe7e340
7
- data.tar.gz: c2688bad7d4ee07c582f7d5baf664998472fe6132a92f1cf11301f6f7174dfc5fac42f85e18045403eefefe5e13f6e4a6b619dcb75198d79204e6e1deb8f6703
6
+ metadata.gz: 139beeb8df66b8498e15f49c887616c8aa70a1959ca1d1d3b495727da515c7a2558c8cb4502d183739952f41f7dc1865be06dce64b842b0d54d8d207ef531243
7
+ data.tar.gz: e5ef82c4542c6533e99979702881fa820b27998992a1b6d2baa83279927923b3f14b9b0b29994fe7ed5c656280989ea42456ac6ad946184fa7e1caf7e4c2dbc0
@@ -47,11 +47,22 @@ window.load_states = ->
47
47
  if countryCode
48
48
  $.ajax
49
49
  type: 'get'
50
- url: '/states'
50
+ url: '/states_list'
51
51
  dataType: 'script'
52
52
  data:
53
53
  country_id: countryCode
54
54
 
55
+ window.load_edit_states = (state_id) ->
56
+ countryCode = $("#country_dropdown option:selected").val()
57
+ if countryCode
58
+ $.ajax
59
+ type: 'get'
60
+ url: '/states_list'
61
+ dataType: 'script'
62
+ data:
63
+ country_id: countryCode
64
+ state_id: state_id
65
+
55
66
  class App
56
67
  init: ->
57
68
 
@@ -81,8 +81,9 @@ module Gaku
81
81
 
82
82
  def set_countries_and_states
83
83
  @countries = Country.all
84
- @default_country = Country.where(name: Preset.address('country')).first
85
- @default_state = State.where(name_ascii: Preset.address('state')).first
84
+
85
+ @default_country = Preset.country
86
+ @default_state = Preset.state
86
87
  @states = @default_country.states if @default_country
87
88
  end
88
89
 
@@ -1,12 +1,16 @@
1
1
  module Gaku
2
- class StatesController < GakuController
2
+ class StatesListController < GakuController
3
3
  respond_to :js, :json
4
4
 
5
5
  def index
6
6
  if params[:country_id]
7
7
  @country = Country.find(params[:country_id])
8
8
  @states = State.where(country_iso: @country.iso)
9
- .order('name asc')
9
+ if params[:state_id]
10
+ @state = State.find(params[:state_id])
11
+ else
12
+ @state = Preset.state
13
+ end
10
14
  else
11
15
  @states = State.all
12
16
  end
@@ -4,11 +4,10 @@
4
4
 
5
5
  .row
6
6
  .col-md-3
7
- = f.select :country_id, options_from_collection_for_select(@countries, :id, :name, (f.object.country_id || @default_country.try(:id))) , { prompt: t(:'address.choose_country') }, { id: "country_dropdown", label: t(:'address.country') }
7
+ = f.select :country_id, options_from_collection_for_select(@countries, :id, :i18n_name, (f.object.country_id || @default_country.try(:id))) , { prompt: t(:'address.choose_country') }, { id: "country_dropdown", label: t(:'address.country') }
8
8
  .col-md-3
9
9
  #state-dropdown
10
- = f.select :state_id, options_from_collection_for_select(state_load(f.object), :id, :name, (f.object.state_id || @default_state.try(:id))), { prompt: t(:'address.state.choose') }, { class: 'form-control', disabled: disabled?(f.object), label: t(:'address.state') }
11
-
10
+ = f.select :state_id, options_from_collection_for_select(state_load(f.object), :id, :i18n_name, (f.object.state_id || @default_state.try(:id))), { prompt: t(:'address.state.choose') }, { class: 'form-control', disabled: disabled?(f.object), label: t(:'address.state.singular') }
12
11
  .col-md-3
13
12
  = f.text_field :zipcode, label: t(:'address.zipcode')
14
13
 
@@ -1,4 +1,4 @@
1
1
  $('#modal-dialogs').html('<%= j render("modal", {address: @address}) %>');
2
2
  $('#edit-address-modal').modal('show');
3
3
  $('.remote-form').enableValidations();
4
- load_states();
4
+ load_edit_states(<%= @address.state_id %>);
@@ -1,10 +1,8 @@
1
- /- content_for :title, translate("comname")
2
1
  - if user_signed_in?
3
2
  = render partial: 'user_info'
4
3
  = render partial: 'user_menu'
5
4
  - else
6
- | 下記のリンクからログインを行ってください。
7
- #{link_to t("devise.sign_in"), new_user_session_path}
5
+ = link_to t(:"devise.sign_in"), new_user_session_path
8
6
 
9
7
  .panel.panel-default
10
8
  .panel-body
@@ -0,0 +1,4 @@
1
+ = fields_for :address do |a|
2
+ = a.label :state_id, t(:'address.state.singular')
3
+ = a.select :state_id, options_from_collection_for_select(states, :id, :i18n_name), { prompt: t(:'address.state.choose') }, disabled: true, class: 'form-control'
4
+
@@ -0,0 +1,3 @@
1
+ = fields_for :address do |a|
2
+ = a.label :state_id, t(:'address.state.singular')
3
+ = a.select :state_id, options_from_collection_for_select(states, :id, :i18n_name, state.try(:id)), { prompt: t(:'address.state.choose') }, { class: 'form-control' }
@@ -0,0 +1,5 @@
1
+ if(<%= @states.count %> > 0 ) {
2
+ $('#state-dropdown').html("<%=j render 'states_select', states: @states, state: @state %>")
3
+ } else {
4
+ $('#state-dropdown').html("<%=j render 'no_states_select', states: @states %>")
5
+ }
@@ -56,6 +56,8 @@ Gaku::Core::Engine.routes.draw do
56
56
  post :create_admin, to: 'devise/registrations#create_admin'
57
57
  end
58
58
 
59
+ resources :states_list, only: :index
60
+
59
61
  resources :extracurricular_activities, concerns: %i( pagination enrollmentable )
60
62
 
61
63
  resources :class_groups, concerns: %i( notes student_selection pagination semesterable) do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gaku_frontend
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rei Kagetsuki
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2015-02-23 00:00:00.000000000 Z
14
+ date: 2015-03-27 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: gaku_core
@@ -19,28 +19,28 @@ dependencies:
19
19
  requirements:
20
20
  - - '='
21
21
  - !ruby/object:Gem::Version
22
- version: 0.2.2
22
+ version: 0.2.3
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - '='
28
28
  - !ruby/object:Gem::Version
29
- version: 0.2.2
29
+ version: 0.2.3
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: gaku_testing
32
32
  requirement: !ruby/object:Gem::Requirement
33
33
  requirements:
34
34
  - - '='
35
35
  - !ruby/object:Gem::Version
36
- version: 0.2.2
36
+ version: 0.2.3
37
37
  type: :runtime
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
40
40
  requirements:
41
41
  - - '='
42
42
  - !ruby/object:Gem::Version
43
- version: 0.2.2
43
+ version: 0.2.3
44
44
  - !ruby/object:Gem::Dependency
45
45
  name: coffee-rails
46
46
  requirement: !ruby/object:Gem::Requirement
@@ -101,16 +101,16 @@ dependencies:
101
101
  name: slim
102
102
  requirement: !ruby/object:Gem::Requirement
103
103
  requirements:
104
- - - '='
104
+ - - "~>"
105
105
  - !ruby/object:Gem::Version
106
- version: 2.0.0
106
+ version: '3.0'
107
107
  type: :runtime
108
108
  prerelease: false
109
109
  version_requirements: !ruby/object:Gem::Requirement
110
110
  requirements:
111
- - - '='
111
+ - - "~>"
112
112
  - !ruby/object:Gem::Version
113
- version: 2.0.0
113
+ version: '3.0'
114
114
  - !ruby/object:Gem::Dependency
115
115
  name: responders
116
116
  requirement: !ruby/object:Gem::Requirement
@@ -229,14 +229,14 @@ dependencies:
229
229
  requirements:
230
230
  - - '='
231
231
  - !ruby/object:Gem::Version
232
- version: 2.1.1
232
+ version: 2.1.4
233
233
  type: :runtime
234
234
  prerelease: false
235
235
  version_requirements: !ruby/object:Gem::Requirement
236
236
  requirements:
237
237
  - - '='
238
238
  - !ruby/object:Gem::Version
239
- version: 2.1.1
239
+ version: 2.1.4
240
240
  - !ruby/object:Gem::Dependency
241
241
  name: bootstrap-sass
242
242
  requirement: !ruby/object:Gem::Requirement
@@ -426,7 +426,7 @@ files:
426
426
  - app/controllers/gaku/realtime_controller.rb
427
427
  - app/controllers/gaku/search_controller.rb
428
428
  - app/controllers/gaku/semester_connectors_controller.rb
429
- - app/controllers/gaku/states_controller.rb
429
+ - app/controllers/gaku/states_list_controller.rb
430
430
  - app/controllers/gaku/student_selection_controller.rb
431
431
  - app/controllers/gaku/students/badges_controller.rb
432
432
  - app/controllers/gaku/students/class_group_enrollments_controller.rb
@@ -767,9 +767,9 @@ files:
767
767
  - app/views/gaku/shared/student_chooser/_modal.html.slim
768
768
  - app/views/gaku/shared/student_selection/_chooser.html.slim
769
769
  - app/views/gaku/shared/student_selection/_modal.html.slim
770
- - app/views/gaku/states/_no_states_select.html.slim
771
- - app/views/gaku/states/_states_select.html.slim
772
- - app/views/gaku/states/index.js.erb
770
+ - app/views/gaku/states_list/_no_states_select.html.slim
771
+ - app/views/gaku/states_list/_states_select.html.slim
772
+ - app/views/gaku/states_list/index.js.erb
773
773
  - app/views/gaku/student_selection/_selected_student.html.slim
774
774
  - app/views/gaku/student_selection/add.js.erb
775
775
  - app/views/gaku/student_selection/clear.js.erb
@@ -1 +0,0 @@
1
- = collection_select(:address, :state_id, states, :id, :name, {prompt: t(:'address.state.choose') }, disabled: true, class: 'span12 form-control')
@@ -1 +0,0 @@
1
- = collection_select(:address, :state_id, states, :id, :name, {prompt: t(:'address.state.choose') }, class: 'span12 form-control')
@@ -1,5 +0,0 @@
1
- if(<%= @states.count %> > 0 ){
2
- $('#state-dropdown .controls').html("<%=j render 'states_select', states: @states%>")
3
- }else{
4
- $('#state-dropdown .controls').html("<%=j render 'no_states_select', states: @states%>")
5
- }