Description:
add best_in_place tidy up route
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r474:24d67ab56dc2 - - 7 files changed: 32 inserted, 4 deleted

@@ -16,45 +16,48
16 16 # See https://github.com/sstephenson/execjs#readme for more supported runtimes
17 17 # gem 'therubyracer', :platforms => :ruby
18 18
19 19 gem 'uglifier', '>= 1.0.3'
20 20 end
21 21
22 22 gem 'prototype-rails'
23 23
24 24 # To use ActiveModel has_secure_password
25 25 # gem 'bcrypt-ruby', '~> 3.0.0'
26 26
27 27 # To use Jbuilder templates for JSON
28 28 # gem 'jbuilder'
29 29
30 30 # Use unicorn as the app server
31 31 # gem 'unicorn'
32 32
33 33 # Deploy with Capistrano
34 34 # gem 'capistrano'
35 35
36 36 # To use debugger
37 37 # gem 'debugger'
38 38 #
39 39
40 + #in-place editor
41 + gem 'best_in_place', '~> 3.0.1'
42 +
40 43 # jquery addition
41 44 gem 'jquery-rails'
42 45 gem 'jquery-ui-sass-rails'
43 46 gem 'jquery-timepicker-addon-rails'
44 47 gem 'jquery-tablesorter'
45 48
46 49 #syntax highlighter
47 50 gem 'rouge'
48 51
49 52 gem "haml"
50 53 gem "mail"
51 54 gem "rdiscount"
52 55 gem "test-unit"
53 56 gem 'will_paginate', '~> 3.0.0'
54 57 gem 'dynamic_form'
55 58 gem 'in_place_editing'
56 59 gem 'verification', :git => 'git://github.com/sikachu/verification.git'
57 60
58 61 group :test, :development do
59 62 gem "rspec-rails", "~> 2.0"
60 63 end
@@ -16,48 +16,51
16 16 activemodel (= 3.2.19)
17 17 activesupport (= 3.2.19)
18 18 builder (~> 3.0.0)
19 19 erubis (~> 2.7.0)
20 20 journey (~> 1.0.4)
21 21 rack (~> 1.4.5)
22 22 rack-cache (~> 1.2)
23 23 rack-test (~> 0.6.1)
24 24 sprockets (~> 2.2.1)
25 25 activemodel (3.2.19)
26 26 activesupport (= 3.2.19)
27 27 builder (~> 3.0.0)
28 28 activerecord (3.2.19)
29 29 activemodel (= 3.2.19)
30 30 activesupport (= 3.2.19)
31 31 arel (~> 3.0.2)
32 32 tzinfo (~> 0.3.29)
33 33 activeresource (3.2.19)
34 34 activemodel (= 3.2.19)
35 35 activesupport (= 3.2.19)
36 36 activesupport (3.2.19)
37 37 i18n (~> 0.6, >= 0.6.4)
38 38 multi_json (~> 1.0)
39 39 arel (3.0.3)
40 + best_in_place (3.0.2)
41 + actionpack (>= 3.2)
42 + railties (>= 3.2)
40 43 builder (3.0.4)
41 44 coffee-rails (3.2.2)
42 45 coffee-script (>= 2.2.0)
43 46 railties (~> 3.2.0)
44 47 coffee-script (2.3.0)
45 48 coffee-script-source
46 49 execjs
47 50 coffee-script-source (1.7.1)
48 51 diff-lcs (1.2.5)
49 52 dynamic_form (1.1.4)
50 53 erubis (2.7.0)
51 54 execjs (2.2.1)
52 55 haml (4.0.5)
53 56 tilt
54 57 hike (1.2.3)
55 58 i18n (0.6.11)
56 59 in_place_editing (1.2.0)
57 60 journey (1.0.4)
58 61 jquery-rails (3.1.1)
59 62 railties (>= 3.0, < 5.0)
60 63 thor (>= 0.14, < 2.0)
61 64 jquery-tablesorter (1.12.7)
62 65 railties (>= 3.1, < 5)
63 66 jquery-timepicker-addon-rails (1.4.1)
@@ -128,44 +131,45
128 131 sass (>= 3.1.10)
129 132 tilt (~> 1.3)
130 133 sprockets (2.2.2)
131 134 hike (~> 1.2)
132 135 multi_json (~> 1.0)
133 136 rack (~> 1.0)
134 137 tilt (~> 1.1, != 1.3.0)
135 138 test-unit (3.0.1)
136 139 power_assert
137 140 thor (0.19.1)
138 141 tilt (1.4.1)
139 142 treetop (1.4.15)
140 143 polyglot
141 144 polyglot (>= 0.3.1)
142 145 tzinfo (0.3.41)
143 146 uglifier (2.5.3)
144 147 execjs (>= 0.3.0)
145 148 json (>= 1.8.0)
146 149 will_paginate (3.0.7)
147 150
148 151 PLATFORMS
149 152 ruby
150 153
151 154 DEPENDENCIES
155 + best_in_place (~> 3.0.1)
152 156 coffee-rails (~> 3.2.1)
153 157 dynamic_form
154 158 haml
155 159 in_place_editing
156 160 jquery-rails
157 161 jquery-tablesorter
158 162 jquery-timepicker-addon-rails
159 163 jquery-ui-sass-rails
160 164 mail
161 165 mysql2
162 166 prototype-rails
163 167 rails (= 3.2.19)
164 168 rdiscount
165 169 rouge
166 170 rspec-rails (~> 2.0)
167 171 sass-rails (~> 3.2.3)
168 172 test-unit
169 173 uglifier (>= 1.0.3)
170 174 verification!
171 175 will_paginate (~> 3.0.0)
@@ -1,7 +1,14
1 1 //= require jquery
2 2 //= require jquery_ujs
3 3 //= require jquery.ui.all
4 4 //= require jquery.ui.datepicker
5 5 //= require jquery.ui.slider
6 6 //= require jquery-ui-timepicker-addon
7 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 1 class ConfigurationsController < ApplicationController
2 2
3 3 before_filter :authenticate
4 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 7 def index
11 8 @configurations = GraderConfiguration.find(:all,
12 9 :order => '`key`')
13 10 end
14 11
15 12 def reload
16 13 GraderConfiguration.reload
17 14 redirect_to :action => 'index'
18 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) }
20 24 end
25 + end
26 + end
27 +
28 + end
@@ -1,29 +1,32
1 + - content_for :header do
2 + = javascript_include_tag 'local_jquery'
3 +
1 4 %h1 System configuration
2 5
3 6 %table.info
4 7 %tr.info-head
5 8 %th Key
6 9 %th Type
7 10 %th Value
8 11 %th Description
9 12 - @configurations.each do |conf|
10 13 - @grader_configuration = conf
11 14 %tr{:class => cycle("info-odd", "info-even")}
12 15 %td
13 16 = in_place_editor_field :grader_configuration, :key, {}, :rows=>1
14 17 %td
15 18 = in_place_editor_field :grader_configuration, :value_type, {}, :rows=>1
16 19 %td
17 - = in_place_editor_field :grader_configuration, :value, {}, :rows=>1
20 + = best_in_place @grader_configuration, :value, ok_button: "ok", cancel_button: "cancel"
18 21 %td= conf.description
19 22
20 23 - if GraderConfiguration.config_cached?
21 24 %br/
22 25 Your config is saved, but it does not automatically take effect.
23 26 %br/
24 27 If you have one mongrel process running, you can
25 28 = link_to '[click]', :action => 'reload'
26 29 here to reload.
27 30 %br/
28 31 If you have more than one process running, you should restart
29 32 them manually.
@@ -1,26 +1,27
1 1 - content_for :head do
2 2 = stylesheet_link_tag 'graders'
3 + = javascript_include_tag 'local_jquery'
3 4 <meta http-equiv ="refresh" content="60"/>
4 5
5 6 %h1 Grader information
6 7
7 8 = link_to '[Refresh]', :action => 'list'
8 9 %br/
9 10
10 11 .submitbox
11 12 .item
12 13 Grader control:
13 14 .item
14 15 = form_for :clear, :url => {:action => 'start_grading'} do |f|
15 16 = submit_tag 'Start graders in grading env'
16 17 .item
17 18 = form_for :clear, :url => {:action => 'start_exam'} do |f|
18 19 = submit_tag 'Start graders in exam env'
19 20 .item
20 21 = form_for :clear, :url => {:action => 'stop_all'} do |f|
21 22 = submit_tag 'Stop all running graders'
22 23 .item
23 24 = form_for :clear, :url => {:action => 'clear_all'} do |f|
24 25 = submit_tag 'Clear all data'
25 26 %br{:style => 'clear:both'}/
26 27
@@ -1,32 +1,34
1 1 CafeGrader::Application.routes.draw do
2 2 get "report/login"
3 3
4 4 resources :contests
5 5
6 6 resources :announcements
7 7 resources :sites
8 8
9 + resources :grader_configuration, controller: 'configurations'
10 +
9 11 # The priority is based upon order of creation:
10 12 # first created -> highest priority.
11 13
12 14 # Sample of regular route:
13 15 # match 'products/:id' => 'catalog#view'
14 16 # Keep in mind you can assign values other than :controller and :action
15 17
16 18 # Sample of named route:
17 19 # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
18 20 # This route can be invoked with purchase_url(:id => product.id)
19 21
20 22 # Sample resource route (maps HTTP verbs to controller actions automatically):
21 23 # resources :products
22 24
23 25 # Sample resource route with options:
24 26 # resources :products do
25 27 # member do
26 28 # get 'short'
27 29 # post 'toggle'
28 30 # end
29 31 #
30 32 # collection do
31 33 # get 'sold'
32 34 # end
You need to be logged in to leave comments. Login now