Description:
add best_in_place
tidy up route
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r474:24d67ab56dc2 - - 7 files changed: 32 inserted, 4 deleted
@@ -34,12 +34,15 | |||||
|
34 | # gem 'capistrano' |
|
34 | # gem 'capistrano' |
|
35 |
|
35 | ||
|
36 | # To use debugger |
|
36 | # To use debugger |
|
37 | # gem 'debugger' |
|
37 | # gem 'debugger' |
|
38 | # |
|
38 | # |
|
39 |
|
39 | ||
|
|
40 | + #in-place editor | ||
|
|
41 | + gem 'best_in_place', '~> 3.0.1' | ||
|
|
42 | + | ||
|
40 | # jquery addition |
|
43 | # jquery addition |
|
41 | gem 'jquery-rails' |
|
44 | gem 'jquery-rails' |
|
42 | gem 'jquery-ui-sass-rails' |
|
45 | gem 'jquery-ui-sass-rails' |
|
43 | gem 'jquery-timepicker-addon-rails' |
|
46 | gem 'jquery-timepicker-addon-rails' |
|
44 | gem 'jquery-tablesorter' |
|
47 | gem 'jquery-tablesorter' |
|
45 |
|
48 |
@@ -34,12 +34,15 | |||||
|
34 | activemodel (= 3.2.19) |
|
34 | activemodel (= 3.2.19) |
|
35 | activesupport (= 3.2.19) |
|
35 | activesupport (= 3.2.19) |
|
36 | activesupport (3.2.19) |
|
36 | activesupport (3.2.19) |
|
37 | i18n (~> 0.6, >= 0.6.4) |
|
37 | i18n (~> 0.6, >= 0.6.4) |
|
38 | multi_json (~> 1.0) |
|
38 | multi_json (~> 1.0) |
|
39 | arel (3.0.3) |
|
39 | arel (3.0.3) |
|
|
40 | + best_in_place (3.0.2) | ||
|
|
41 | + actionpack (>= 3.2) | ||
|
|
42 | + railties (>= 3.2) | ||
|
40 | builder (3.0.4) |
|
43 | builder (3.0.4) |
|
41 | coffee-rails (3.2.2) |
|
44 | coffee-rails (3.2.2) |
|
42 | coffee-script (>= 2.2.0) |
|
45 | coffee-script (>= 2.2.0) |
|
43 | railties (~> 3.2.0) |
|
46 | railties (~> 3.2.0) |
|
44 | coffee-script (2.3.0) |
|
47 | coffee-script (2.3.0) |
|
45 | coffee-script-source |
|
48 | coffee-script-source |
@@ -146,12 +149,13 | |||||
|
146 | will_paginate (3.0.7) |
|
149 | will_paginate (3.0.7) |
|
147 |
|
150 | ||
|
148 | PLATFORMS |
|
151 | PLATFORMS |
|
149 | ruby |
|
152 | ruby |
|
150 |
|
153 | ||
|
151 | DEPENDENCIES |
|
154 | DEPENDENCIES |
|
|
155 | + best_in_place (~> 3.0.1) | ||
|
152 | coffee-rails (~> 3.2.1) |
|
156 | coffee-rails (~> 3.2.1) |
|
153 | dynamic_form |
|
157 | dynamic_form |
|
154 | haml |
|
158 | haml |
|
155 | in_place_editing |
|
159 | in_place_editing |
|
156 | jquery-rails |
|
160 | jquery-rails |
|
157 | jquery-tablesorter |
|
161 | jquery-tablesorter |
@@ -2,6 +2,13 | |||||
|
2 | //= require jquery_ujs |
|
2 | //= require jquery_ujs |
|
3 | //= require jquery.ui.all |
|
3 | //= require jquery.ui.all |
|
4 | //= require jquery.ui.datepicker |
|
4 | //= require jquery.ui.datepicker |
|
5 | //= require jquery.ui.slider |
|
5 | //= require jquery.ui.slider |
|
6 | //= require jquery-ui-timepicker-addon |
|
6 | //= require jquery-ui-timepicker-addon |
|
7 | //= require jquery-tablesorter |
|
7 | //= require jquery-tablesorter |
|
|
8 | + //= require best_in_place | ||
|
|
9 | + //= require best_in_place.jquery-ui | ||
|
|
10 | + | ||
|
|
11 | + $(document).ready(function() { | ||
|
|
12 | + /* Activating Best In Place */ | ||
|
|
13 | + jQuery(".best_in_place").best_in_place(); | ||
|
|
14 | + }); |
@@ -1,20 +1,28 | |||||
|
1 | class ConfigurationsController < ApplicationController |
|
1 | class ConfigurationsController < ApplicationController |
|
2 |
|
2 | ||
|
3 | before_filter :authenticate |
|
3 | before_filter :authenticate |
|
4 | before_filter { |controller| controller.authorization_by_roles(['admin'])} |
|
4 | before_filter { |controller| controller.authorization_by_roles(['admin'])} |
|
5 |
|
5 | ||
|
6 | - in_place_edit_for :grader_configuration, :key |
|
||
|
7 | - in_place_edit_for :grader_configuration, :type |
|
||
|
8 | - in_place_edit_for :grader_configuration, :value |
|
||
|
9 |
|
6 | ||
|
10 | def index |
|
7 | def index |
|
11 | @configurations = GraderConfiguration.find(:all, |
|
8 | @configurations = GraderConfiguration.find(:all, |
|
12 | :order => '`key`') |
|
9 | :order => '`key`') |
|
13 | end |
|
10 | end |
|
14 |
|
11 | ||
|
15 | def reload |
|
12 | def reload |
|
16 | GraderConfiguration.reload |
|
13 | GraderConfiguration.reload |
|
17 | redirect_to :action => 'index' |
|
14 | redirect_to :action => 'index' |
|
18 | end |
|
15 | end |
|
19 |
|
16 | ||
|
|
17 | + def update | ||
|
|
18 | + @config = GraderConfiguration.find(params[:id]) | ||
|
|
19 | + respond_to do |format| | ||
|
|
20 | + if @config.update_attributes(params[:grader_configuration]) | ||
|
|
21 | + format.json { head :ok } | ||
|
|
22 | + else | ||
|
|
23 | + format.json { respond_with_bip(@config) } | ||
|
|
24 | + end | ||
|
|
25 | + end | ||
|
|
26 | + end | ||
|
|
27 | + | ||
|
20 | end |
|
28 | end |
@@ -1,6 +1,9 | |||||
|
|
1 | + - content_for :header do | ||
|
|
2 | + = javascript_include_tag 'local_jquery' | ||
|
|
3 | + | ||
|
1 | %h1 System configuration |
|
4 | %h1 System configuration |
|
2 |
|
5 | ||
|
3 | %table.info |
|
6 | %table.info |
|
4 | %tr.info-head |
|
7 | %tr.info-head |
|
5 | %th Key |
|
8 | %th Key |
|
6 | %th Type |
|
9 | %th Type |
@@ -11,13 +14,13 | |||||
|
11 | %tr{:class => cycle("info-odd", "info-even")} |
|
14 | %tr{:class => cycle("info-odd", "info-even")} |
|
12 | %td |
|
15 | %td |
|
13 | = in_place_editor_field :grader_configuration, :key, {}, :rows=>1 |
|
16 | = in_place_editor_field :grader_configuration, :key, {}, :rows=>1 |
|
14 | %td |
|
17 | %td |
|
15 | = in_place_editor_field :grader_configuration, :value_type, {}, :rows=>1 |
|
18 | = in_place_editor_field :grader_configuration, :value_type, {}, :rows=>1 |
|
16 | %td |
|
19 | %td |
|
17 |
- = in_place |
|
20 | + = best_in_place @grader_configuration, :value, ok_button: "ok", cancel_button: "cancel" |
|
18 | %td= conf.description |
|
21 | %td= conf.description |
|
19 |
|
22 | ||
|
20 | - if GraderConfiguration.config_cached? |
|
23 | - if GraderConfiguration.config_cached? |
|
21 | %br/ |
|
24 | %br/ |
|
22 | Your config is saved, but it does not automatically take effect. |
|
25 | Your config is saved, but it does not automatically take effect. |
|
23 | %br/ |
|
26 | %br/ |
@@ -1,8 +1,9 | |||||
|
1 | - content_for :head do |
|
1 | - content_for :head do |
|
2 | = stylesheet_link_tag 'graders' |
|
2 | = stylesheet_link_tag 'graders' |
|
|
3 | + = javascript_include_tag 'local_jquery' | ||
|
3 | <meta http-equiv ="refresh" content="60"/> |
|
4 | <meta http-equiv ="refresh" content="60"/> |
|
4 |
|
5 | ||
|
5 | %h1 Grader information |
|
6 | %h1 Grader information |
|
6 |
|
7 | ||
|
7 | = link_to '[Refresh]', :action => 'list' |
|
8 | = link_to '[Refresh]', :action => 'list' |
|
8 | %br/ |
|
9 | %br/ |
@@ -3,12 +3,14 | |||||
|
3 |
|
3 | ||
|
4 | resources :contests |
|
4 | resources :contests |
|
5 |
|
5 | ||
|
6 | resources :announcements |
|
6 | resources :announcements |
|
7 | resources :sites |
|
7 | resources :sites |
|
8 |
|
8 | ||
|
|
9 | + resources :grader_configuration, controller: 'configurations' | ||
|
|
10 | + | ||
|
9 | # The priority is based upon order of creation: |
|
11 | # The priority is based upon order of creation: |
|
10 | # first created -> highest priority. |
|
12 | # first created -> highest priority. |
|
11 |
|
13 | ||
|
12 | # Sample of regular route: |
|
14 | # Sample of regular route: |
|
13 | # match 'products/:id' => 'catalog#view' |
|
15 | # match 'products/:id' => 'catalog#view' |
|
14 | # Keep in mind you can assign values other than :controller and :action |
|
16 | # Keep in mind you can assign values other than :controller and :action |
You need to be logged in to leave comments.
Login now