Description:
change announcement toggle into bootstrap button with processing state
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r557:47db9776ed2e - - 8 files changed: 75 inserted, 56 deleted
@@ -0,0 +1,15 | |||||
|
|
1 | + #js for announcement | ||
|
|
2 | + $ -> | ||
|
|
3 | + $('.ajax-toggle').on 'click', (event) -> | ||
|
|
4 | + console.log event.target.id | ||
|
|
5 | + target = $(event.target) | ||
|
|
6 | + target.removeClass 'btn-default' | ||
|
|
7 | + target.removeClass 'btn-success' | ||
|
|
8 | + target.addClass 'btn-warning' | ||
|
|
9 | + target.text '...' | ||
|
|
10 | + return | ||
|
|
11 | + | ||
|
|
12 | + $(document).ajaxError (event, jqxhr, settings, exception) -> | ||
|
|
13 | + if jqxhr.status | ||
|
|
14 | + alert 'We\'re sorry, but something went wrong (' + jqxhr.status + ')' | ||
|
|
15 | + return |
@@ -0,0 +1,37 | |||||
|
|
1 | + %h1 Listing announcements | ||
|
|
2 | + | ||
|
|
3 | + = link_to '+ Add announcement', new_announcement_path, class: 'btn btn-success' | ||
|
|
4 | + %br | ||
|
|
5 | + %br | ||
|
|
6 | + | ||
|
|
7 | + %table.table.table-striped | ||
|
|
8 | + %tr | ||
|
|
9 | + %th Updated | ||
|
|
10 | + %th Announcement | ||
|
|
11 | + %th Author | ||
|
|
12 | + %th Published | ||
|
|
13 | + %th | ||
|
|
14 | + %th | ||
|
|
15 | + - for announcement in @announcements | ||
|
|
16 | + %tr | ||
|
|
17 | + - @announcement = announcement | ||
|
|
18 | + %td= time_ago_in_words announcement.updated_at | ||
|
|
19 | + %td | ||
|
|
20 | + - if !announcement.title.blank? | ||
|
|
21 | + %b Title: | ||
|
|
22 | + = h announcement.title | ||
|
|
23 | + %br/ | ||
|
|
24 | + - if !announcement.notes.blank? | ||
|
|
25 | + %b | ||
|
|
26 | + Notes: #{h announcement.notes} | ||
|
|
27 | + %br/ | ||
|
|
28 | + = h announcement.body | ||
|
|
29 | + %td= h announcement.author | ||
|
|
30 | + // %td= check_box_tag :published, 1, announcement.published, { class: 'bootstrap-toggle', id: "published-#{announcement.id}", data: {remote: true, method: 'PUT', url: url_for(controller: :announcements, action: :toggle, id: announcement), size: 'small', toggle: 'toggle' } } | ||
|
|
31 | + // <td><haml_loud> in_place_editor_field :announcement, :published, {}, :rows => 1 </haml_loud></td> | ||
|
|
32 | + %td= link_to (announcement.published? ? "Yes" : "No"), url_for(controller: :announcements, action: :toggle, id: announcement), { class: "btn btn-block btn-sm btn-#{(announcement.published? ? 'success' : 'default')} ajax-toggle", id: "published-#{announcement.id}", data: {remote: true, method: 'post' } } | ||
|
|
33 | + %td= link_to 'Edit', edit_announcement_path(announcement), class: 'btn btn-block btn-sm btn-info' | ||
|
|
34 | + %td= link_to 'Destroy', announcement, :confirm => 'Are you sure?', :method => :delete, class: "btn btn-block btn-sm btn-danger" | ||
|
|
35 | + %br | ||
|
|
36 | + | ||
|
|
37 | + = link_to '+ Add announcement', new_announcement_path, class: 'btn btn-success' |
@@ -0,0 +1,8 | |||||
|
|
1 | + :plain | ||
|
|
2 | + var t = $("#published-#{@announcement.id}"); | ||
|
|
3 | + t.removeClass('btn-default'); | ||
|
|
4 | + t.removeClass('btn-success'); | ||
|
|
5 | + t.removeClass('btn-warning'); | ||
|
|
6 | + t.addClass("btn-#{@announcement.published? ? 'success' : 'default'}"); | ||
|
|
7 | + t.attr("data-params","published=#{!@announcement.published?}"); | ||
|
|
8 | + t.text("#{@announcement.published? ? "Yes" : "No"}"); |
@@ -1,351 +1,351 | |||||
|
1 | /* |
|
1 | /* |
|
2 | * This is a manifest file that'll be compiled into application.css, which will include all the files |
|
2 | * This is a manifest file that'll be compiled into application.css, which will include all the files |
|
3 | * listed below. |
|
3 | * listed below. |
|
4 | * |
|
4 | * |
|
5 | * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, |
|
5 | * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, |
|
6 | * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path. |
|
6 | * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path. |
|
7 | * |
|
7 | * |
|
8 | * You're free to add application-wide styles to this file and they'll appear at the bottom of the |
|
8 | * You're free to add application-wide styles to this file and they'll appear at the bottom of the |
|
9 | * compiled file so the styles you add here take precedence over styles defined in any styles |
|
9 | * compiled file so the styles you add here take precedence over styles defined in any styles |
|
10 | * defined in the other CSS/SCSS files in this directory. It is generally better to create a new |
|
10 | * defined in the other CSS/SCSS files in this directory. It is generally better to create a new |
|
11 | * file per style scope. |
|
11 | * file per style scope. |
|
12 | * |
|
12 | * |
|
13 | // bootstrap says that we should not do this, but @import each file instead |
|
13 | // bootstrap says that we should not do this, but @import each file instead |
|
14 | # *= require_tree . |
|
14 | # *= require_tree . |
|
15 | # *= require_self |
|
15 | # *= require_self |
|
16 | */ |
|
16 | */ |
|
17 |
|
17 | ||
|
18 | @import jquery.ui.all |
|
18 | @import jquery.ui.all |
|
19 | @import jquery.ui.core |
|
19 | @import jquery.ui.core |
|
20 | @import jquery.ui.core |
|
20 | @import jquery.ui.core |
|
21 | @import jquery.ui.theme |
|
21 | @import jquery.ui.theme |
|
22 | @import jquery.ui.datepicker |
|
22 | @import jquery.ui.datepicker |
|
23 | @import jquery.ui.slider |
|
23 | @import jquery.ui.slider |
|
24 | @import jquery-ui-timepicker-addon |
|
24 | @import jquery-ui-timepicker-addon |
|
25 | @import jquery-tablesorter/theme.metro-dark |
|
25 | @import jquery-tablesorter/theme.metro-dark |
|
26 | @import tablesorter-theme.cafe |
|
26 | @import tablesorter-theme.cafe |
|
27 |
|
27 | ||
|
28 | //bootstrap |
|
28 | //bootstrap |
|
29 | @import bootstrap-sprockets |
|
29 | @import bootstrap-sprockets |
|
30 | @import bootstrap |
|
30 | @import bootstrap |
|
31 | @import select2 |
|
31 | @import select2 |
|
32 | @import select2-bootstrap |
|
32 | @import select2-bootstrap |
|
33 | //@import bootstrap3-switch |
|
33 | //@import bootstrap3-switch |
|
34 | @import bootstrap-toggle |
|
34 | @import bootstrap-toggle |
|
35 |
|
35 | ||
|
36 | .secondnavbar |
|
36 | .secondnavbar |
|
37 | top: 50px |
|
37 | top: 50px |
|
38 |
|
38 | ||
|
39 | .btn-file |
|
39 | .btn-file |
|
40 | position: relative |
|
40 | position: relative |
|
41 | overflow: hidden |
|
41 | overflow: hidden |
|
42 |
|
42 | ||
|
43 | .btn-file input[type=file] |
|
43 | .btn-file input[type=file] |
|
44 | position: absolute |
|
44 | position: absolute |
|
45 | top: 0 |
|
45 | top: 0 |
|
46 | right: 0 |
|
46 | right: 0 |
|
47 | min-width: 100% |
|
47 | min-width: 100% |
|
48 | min-height: 100% |
|
48 | min-height: 100% |
|
49 | font-size: 100px |
|
49 | font-size: 100px |
|
50 | text-align: right |
|
50 | text-align: right |
|
51 | filter: alpha(opacity=0) |
|
51 | filter: alpha(opacity=0) |
|
52 | opacity: 0 |
|
52 | opacity: 0 |
|
53 | outline: none |
|
53 | outline: none |
|
54 | background: white |
|
54 | background: white |
|
55 | cursor: inherit |
|
55 | cursor: inherit |
|
56 | display: block |
|
56 | display: block |
|
57 |
|
57 | ||
|
58 | body |
|
58 | body |
|
59 | background: white image-url("topbg.jpg") repeat-x top center |
|
59 | background: white image-url("topbg.jpg") repeat-x top center |
|
60 | //font-size: 13px |
|
60 | //font-size: 13px |
|
61 | //font-family: Tahoma, "sans-serif" |
|
61 | //font-family: Tahoma, "sans-serif" |
|
62 | margin: 10px |
|
62 | margin: 10px |
|
63 | padding: 10px |
|
63 | padding: 10px |
|
64 | padding-top: 100px |
|
64 | padding-top: 100px |
|
65 |
|
65 | ||
|
66 |
|
66 | ||
|
67 | input |
|
67 | input |
|
68 | font-family: Tahoma, "sans-serif" |
|
68 | font-family: Tahoma, "sans-serif" |
|
69 |
|
69 | ||
|
70 |
|
70 | ||
|
71 | h1 |
|
71 | h1 |
|
72 | font-size: 24px |
|
72 | font-size: 24px |
|
73 | color: #334488 |
|
73 | color: #334488 |
|
74 | line-height: 2em |
|
74 | line-height: 2em |
|
75 |
|
75 | ||
|
76 |
|
76 | ||
|
77 | h2 |
|
77 | h2 |
|
78 | font-size: 18px |
|
78 | font-size: 18px |
|
79 | color: #5566bb |
|
79 | color: #5566bb |
|
80 | line-height: 1.5em |
|
80 | line-height: 1.5em |
|
81 |
|
81 | ||
|
82 |
|
82 | ||
|
83 | hr |
|
83 | hr |
|
84 | border-top: 1px solid #dddddd |
|
84 | border-top: 1px solid #dddddd |
|
85 | border-bottom: 1px solid #eeeeee |
|
85 | border-bottom: 1px solid #eeeeee |
|
86 |
|
86 | ||
|
87 |
|
87 | ||
|
88 | - a |
|
88 | + //#a |
|
89 |
- |
|
89 | + // color: #6666cc |
|
90 |
- |
|
90 | + // text-decoration: none |
|
91 | - |
|
91 | + // |
|
92 |
- |
|
92 | + // &:link, &:visited |
|
93 |
- |
|
93 | + // color: #6666cc |
|
94 |
- |
|
94 | + // text-decoration: none |
|
95 | - |
|
95 | + // |
|
96 |
- |
|
96 | + // &:hover, &:focus |
|
97 |
- |
|
97 | + // color: #111166 |
|
98 |
- |
|
98 | + // text-decoration: none |
|
99 |
|
99 | ||
|
100 |
|
100 | ||
|
101 | div |
|
101 | div |
|
102 | &.userbar |
|
102 | &.userbar |
|
103 | line-height: 1.5em |
|
103 | line-height: 1.5em |
|
104 | text-align: right |
|
104 | text-align: right |
|
105 | font-size: 12px |
|
105 | font-size: 12px |
|
106 |
|
106 | ||
|
107 | &.title |
|
107 | &.title |
|
108 | padding: 10px 0px |
|
108 | padding: 10px 0px |
|
109 | line-height: 1.5em |
|
109 | line-height: 1.5em |
|
110 | font-size: 13px |
|
110 | font-size: 13px |
|
111 |
|
111 | ||
|
112 | span.contest-over-msg |
|
112 | span.contest-over-msg |
|
113 | font-size: 15px |
|
113 | font-size: 15px |
|
114 | color: red |
|
114 | color: red |
|
115 |
|
115 | ||
|
116 | table |
|
116 | table |
|
117 | width: 100% |
|
117 | width: 100% |
|
118 | font-weight: bold |
|
118 | font-weight: bold |
|
119 |
|
119 | ||
|
120 | td |
|
120 | td |
|
121 | &.left-col |
|
121 | &.left-col |
|
122 | text-align: left |
|
122 | text-align: left |
|
123 | vertical-align: top |
|
123 | vertical-align: top |
|
124 | color: #444444 |
|
124 | color: #444444 |
|
125 |
|
125 | ||
|
126 | &.right-col |
|
126 | &.right-col |
|
127 | text-align: right |
|
127 | text-align: right |
|
128 | vertical-align: top |
|
128 | vertical-align: top |
|
129 | font-size: 18px |
|
129 | font-size: 18px |
|
130 | color: #116699 |
|
130 | color: #116699 |
|
131 |
|
131 | ||
|
132 |
|
132 | ||
|
133 | table.info |
|
133 | table.info |
|
134 | margin: 10px 0 |
|
134 | margin: 10px 0 |
|
135 | border: 1px solid #666666 |
|
135 | border: 1px solid #666666 |
|
136 | border-collapse: collapse |
|
136 | border-collapse: collapse |
|
137 | font-size: 12px |
|
137 | font-size: 12px |
|
138 |
|
138 | ||
|
139 | th |
|
139 | th |
|
140 | border: 1px solid #666666 |
|
140 | border: 1px solid #666666 |
|
141 | line-height: 1.5em |
|
141 | line-height: 1.5em |
|
142 | padding: 0 0.5em |
|
142 | padding: 0 0.5em |
|
143 |
|
143 | ||
|
144 | td |
|
144 | td |
|
145 | border-left: 1px solid #666666 |
|
145 | border-left: 1px solid #666666 |
|
146 | border-right: 1px solid #666666 |
|
146 | border-right: 1px solid #666666 |
|
147 | line-height: 1.5em |
|
147 | line-height: 1.5em |
|
148 | padding: 0 0.5em |
|
148 | padding: 0 0.5em |
|
149 |
|
149 | ||
|
150 |
|
150 | ||
|
151 | tr |
|
151 | tr |
|
152 | &.info-head |
|
152 | &.info-head |
|
153 | background: #777777 |
|
153 | background: #777777 |
|
154 | color: white |
|
154 | color: white |
|
155 |
|
155 | ||
|
156 | &.info-odd |
|
156 | &.info-odd |
|
157 | background: #eeeeee |
|
157 | background: #eeeeee |
|
158 |
|
158 | ||
|
159 | &.info-even |
|
159 | &.info-even |
|
160 | background: #fcfcfc |
|
160 | background: #fcfcfc |
|
161 |
|
161 | ||
|
162 | =basicbox |
|
162 | =basicbox |
|
163 | background: #eeeeff |
|
163 | background: #eeeeff |
|
164 | border: 1px dotted #99aaee |
|
164 | border: 1px dotted #99aaee |
|
165 | padding: 5px |
|
165 | padding: 5px |
|
166 | margin: 10px 0px |
|
166 | margin: 10px 0px |
|
167 | color: black |
|
167 | color: black |
|
168 | font-size: 13px |
|
168 | font-size: 13px |
|
169 |
|
169 | ||
|
170 | .infobox |
|
170 | .infobox |
|
171 | +basicbox |
|
171 | +basicbox |
|
172 |
|
172 | ||
|
173 | .submitbox |
|
173 | .submitbox |
|
174 | +basicbox |
|
174 | +basicbox |
|
175 |
|
175 | ||
|
176 | .errorExplanation |
|
176 | .errorExplanation |
|
177 | border: 1px dotted gray |
|
177 | border: 1px dotted gray |
|
178 | color: #bb2222 |
|
178 | color: #bb2222 |
|
179 | padding: 5px 15px 5px 15px |
|
179 | padding: 5px 15px 5px 15px |
|
180 | margin-bottom: 5px |
|
180 | margin-bottom: 5px |
|
181 | background-color: white |
|
181 | background-color: white |
|
182 | font-weight: normal |
|
182 | font-weight: normal |
|
183 |
|
183 | ||
|
184 | h2 |
|
184 | h2 |
|
185 | color: #cc1111 |
|
185 | color: #cc1111 |
|
186 | font-weight: bold |
|
186 | font-weight: bold |
|
187 |
|
187 | ||
|
188 |
|
188 | ||
|
189 | table.uinfo |
|
189 | table.uinfo |
|
190 | border-collapse: collapse |
|
190 | border-collapse: collapse |
|
191 | border: 1px solid black |
|
191 | border: 1px solid black |
|
192 | font-size: 13px |
|
192 | font-size: 13px |
|
193 |
|
193 | ||
|
194 |
|
194 | ||
|
195 | td.uinfo |
|
195 | td.uinfo |
|
196 | vertical-align: top |
|
196 | vertical-align: top |
|
197 | border: 1px solid black |
|
197 | border: 1px solid black |
|
198 | padding: 5px |
|
198 | padding: 5px |
|
199 |
|
199 | ||
|
200 |
|
200 | ||
|
201 | th.uinfo |
|
201 | th.uinfo |
|
202 | background: lightgreen |
|
202 | background: lightgreen |
|
203 | vertical-align: top |
|
203 | vertical-align: top |
|
204 | text-align: right |
|
204 | text-align: right |
|
205 | border: 1px solid black |
|
205 | border: 1px solid black |
|
206 | padding: 5px |
|
206 | padding: 5px |
|
207 |
|
207 | ||
|
208 |
|
208 | ||
|
209 | div |
|
209 | div |
|
210 | &.compilermsgbody |
|
210 | &.compilermsgbody |
|
211 | font-family: monospace |
|
211 | font-family: monospace |
|
212 |
|
212 | ||
|
213 | &.task-menu |
|
213 | &.task-menu |
|
214 | text-align: center |
|
214 | text-align: center |
|
215 | font-size: 13px |
|
215 | font-size: 13px |
|
216 | line-height: 1.75em |
|
216 | line-height: 1.75em |
|
217 | font-weight: bold |
|
217 | font-weight: bold |
|
218 | border-top: 1px dashed gray |
|
218 | border-top: 1px dashed gray |
|
219 | border-bottom: 1px dashed gray |
|
219 | border-bottom: 1px dashed gray |
|
220 | margin-top: 2px |
|
220 | margin-top: 2px |
|
221 | margin-bottom: 4px |
|
221 | margin-bottom: 4px |
|
222 |
|
222 | ||
|
223 |
|
223 | ||
|
224 | table.taskdesc |
|
224 | table.taskdesc |
|
225 | border: 2px solid #dddddd |
|
225 | border: 2px solid #dddddd |
|
226 | border-collapse: collapse |
|
226 | border-collapse: collapse |
|
227 | margin: 10px auto |
|
227 | margin: 10px auto |
|
228 | width: 90% |
|
228 | width: 90% |
|
229 | font-size: 13px |
|
229 | font-size: 13px |
|
230 |
|
230 | ||
|
231 | p |
|
231 | p |
|
232 | font-size: 13px |
|
232 | font-size: 13px |
|
233 |
|
233 | ||
|
234 | tr.name |
|
234 | tr.name |
|
235 | border: 2px solid #dddddd |
|
235 | border: 2px solid #dddddd |
|
236 | background: #dddddd |
|
236 | background: #dddddd |
|
237 | color: #333333 |
|
237 | color: #333333 |
|
238 | font-weight: bold |
|
238 | font-weight: bold |
|
239 | font-size: 14px |
|
239 | font-size: 14px |
|
240 | line-height: 1.5em |
|
240 | line-height: 1.5em |
|
241 | text-align: center |
|
241 | text-align: center |
|
242 |
|
242 | ||
|
243 | td |
|
243 | td |
|
244 | &.desc-odd |
|
244 | &.desc-odd |
|
245 | padding: 5px |
|
245 | padding: 5px |
|
246 | padding-left: 20px |
|
246 | padding-left: 20px |
|
247 | background: #fefeee |
|
247 | background: #fefeee |
|
248 |
|
248 | ||
|
249 | &.desc-even |
|
249 | &.desc-even |
|
250 | padding: 5px |
|
250 | padding: 5px |
|
251 | padding-left: 20px |
|
251 | padding-left: 20px |
|
252 | background: #feeefe |
|
252 | background: #feeefe |
|
253 |
|
253 | ||
|
254 |
|
254 | ||
|
255 | .announcementbox |
|
255 | .announcementbox |
|
256 | margin: 10px 0px |
|
256 | margin: 10px 0px |
|
257 | background: #bbddee |
|
257 | background: #bbddee |
|
258 | padding: 1px |
|
258 | padding: 1px |
|
259 |
|
259 | ||
|
260 | span.title |
|
260 | span.title |
|
261 | font-weight: bold |
|
261 | font-weight: bold |
|
262 | color: #224455 |
|
262 | color: #224455 |
|
263 | padding-left: 10px |
|
263 | padding-left: 10px |
|
264 | line-height: 1.6em |
|
264 | line-height: 1.6em |
|
265 |
|
265 | ||
|
266 | .announcement |
|
266 | .announcement |
|
267 | margin: 2px |
|
267 | margin: 2px |
|
268 | background: white |
|
268 | background: white |
|
269 | padding: 1px |
|
269 | padding: 1px |
|
270 | padding-left: 10px |
|
270 | padding-left: 10px |
|
271 | padding-right: 10px |
|
271 | padding-right: 10px |
|
272 | padding-top: 5px |
|
272 | padding-top: 5px |
|
273 | padding-bottom: 5px |
|
273 | padding-bottom: 5px |
|
274 |
|
274 | ||
|
275 |
|
275 | ||
|
276 | .announcement p |
|
276 | .announcement p |
|
277 | font-size: 12px |
|
277 | font-size: 12px |
|
278 | margin: 2px |
|
278 | margin: 2px |
|
279 |
|
279 | ||
|
280 |
|
280 | ||
|
281 | .pub-info |
|
281 | .pub-info |
|
282 | text-align: right |
|
282 | text-align: right |
|
283 | font-style: italic |
|
283 | font-style: italic |
|
284 | font-size: 9px |
|
284 | font-size: 9px |
|
285 |
|
285 | ||
|
286 | p |
|
286 | p |
|
287 | text-align: right |
|
287 | text-align: right |
|
288 | font-style: italic |
|
288 | font-style: italic |
|
289 | font-size: 9px |
|
289 | font-size: 9px |
|
290 |
|
290 | ||
|
291 |
|
291 | ||
|
292 | .announcement |
|
292 | .announcement |
|
293 | .toggles |
|
293 | .toggles |
|
294 | font-weight: normal |
|
294 | font-weight: normal |
|
295 | float: right |
|
295 | float: right |
|
296 | font-size: 80% |
|
296 | font-size: 80% |
|
297 |
|
297 | ||
|
298 | .announcement-title |
|
298 | .announcement-title |
|
299 | font-weight: bold |
|
299 | font-weight: bold |
|
300 |
|
300 | ||
|
301 |
|
301 | ||
|
302 | div |
|
302 | div |
|
303 | &.message |
|
303 | &.message |
|
304 | margin: 10px 0 0 |
|
304 | margin: 10px 0 0 |
|
305 |
|
305 | ||
|
306 | div |
|
306 | div |
|
307 | &.message |
|
307 | &.message |
|
308 | margin: 0 0 0 30px |
|
308 | margin: 0 0 0 30px |
|
309 |
|
309 | ||
|
310 | &.body |
|
310 | &.body |
|
311 | border: 2px solid #dddddd |
|
311 | border: 2px solid #dddddd |
|
312 | background: #fff8f8 |
|
312 | background: #fff8f8 |
|
313 | padding-left: 5px |
|
313 | padding-left: 5px |
|
314 |
|
314 | ||
|
315 | &.reply-body |
|
315 | &.reply-body |
|
316 | border: 2px solid #bbbbbb |
|
316 | border: 2px solid #bbbbbb |
|
317 | background: #fffff8 |
|
317 | background: #fffff8 |
|
318 | padding-left: 5px |
|
318 | padding-left: 5px |
|
319 |
|
319 | ||
|
320 | &.stat |
|
320 | &.stat |
|
321 | font-size: 10px |
|
321 | font-size: 10px |
|
322 | line-height: 1.75em |
|
322 | line-height: 1.75em |
|
323 | padding: 0 5px |
|
323 | padding: 0 5px |
|
324 | color: #333333 |
|
324 | color: #333333 |
|
325 | background: #dddddd |
|
325 | background: #dddddd |
|
326 | font-weight: bold |
|
326 | font-weight: bold |
|
327 |
|
327 | ||
|
328 | &.message div.stat |
|
328 | &.message div.stat |
|
329 | font-size: 10px |
|
329 | font-size: 10px |
|
330 | line-height: 1.75em |
|
330 | line-height: 1.75em |
|
331 | padding: 0 5px |
|
331 | padding: 0 5px |
|
332 | color: #444444 |
|
332 | color: #444444 |
|
333 | background: #bbbbbb |
|
333 | background: #bbbbbb |
|
334 | font-weight: bold |
|
334 | font-weight: bold |
|
335 |
|
335 | ||
|
336 | &.contest-title |
|
336 | &.contest-title |
|
337 | color: white |
|
337 | color: white |
|
338 | text-align: center |
|
338 | text-align: center |
|
339 | line-height: 2em |
|
339 | line-height: 2em |
|
340 |
|
340 | ||
|
341 | &.registration-desc, &.test-desc |
|
341 | &.registration-desc, &.test-desc |
|
342 | border: 1px dotted gray |
|
342 | border: 1px dotted gray |
|
343 | background: #f5f5f5 |
|
343 | background: #f5f5f5 |
|
344 | padding: 5px |
|
344 | padding: 5px |
|
345 | margin: 10px 0 |
|
345 | margin: 10px 0 |
|
346 | font-size: 12px |
|
346 | font-size: 12px |
|
347 | line-height: 1.5em |
|
347 | line-height: 1.5em |
|
348 |
|
348 | ||
|
349 | h2.contest-title |
|
349 | h2.contest-title |
|
350 | margin-top: 5px |
|
350 | margin-top: 5px |
|
351 | margin-bottom: 5px |
|
351 | margin-bottom: 5px |
@@ -1,101 +1,101 | |||||
|
1 | class AnnouncementsController < ApplicationController |
|
1 | class AnnouncementsController < ApplicationController |
|
2 |
|
2 | ||
|
3 | before_filter :admin_authorization |
|
3 | before_filter :admin_authorization |
|
4 |
|
4 | ||
|
5 | in_place_edit_for :announcement, :published |
|
5 | in_place_edit_for :announcement, :published |
|
6 |
|
6 | ||
|
7 | # GET /announcements |
|
7 | # GET /announcements |
|
8 | # GET /announcements.xml |
|
8 | # GET /announcements.xml |
|
9 | def index |
|
9 | def index |
|
10 | @announcements = Announcement.find(:all, |
|
10 | @announcements = Announcement.find(:all, |
|
11 | :order => "created_at DESC") |
|
11 | :order => "created_at DESC") |
|
12 |
|
12 | ||
|
13 | respond_to do |format| |
|
13 | respond_to do |format| |
|
14 | format.html # index.html.erb |
|
14 | format.html # index.html.erb |
|
15 | format.xml { render :xml => @announcements } |
|
15 | format.xml { render :xml => @announcements } |
|
16 | end |
|
16 | end |
|
17 | end |
|
17 | end |
|
18 |
|
18 | ||
|
19 | # GET /announcements/1 |
|
19 | # GET /announcements/1 |
|
20 | # GET /announcements/1.xml |
|
20 | # GET /announcements/1.xml |
|
21 | def show |
|
21 | def show |
|
22 | @announcement = Announcement.find(params[:id]) |
|
22 | @announcement = Announcement.find(params[:id]) |
|
23 |
|
23 | ||
|
24 | respond_to do |format| |
|
24 | respond_to do |format| |
|
25 | format.html # show.html.erb |
|
25 | format.html # show.html.erb |
|
26 | format.xml { render :xml => @announcement } |
|
26 | format.xml { render :xml => @announcement } |
|
27 | end |
|
27 | end |
|
28 | end |
|
28 | end |
|
29 |
|
29 | ||
|
30 | # GET /announcements/new |
|
30 | # GET /announcements/new |
|
31 | # GET /announcements/new.xml |
|
31 | # GET /announcements/new.xml |
|
32 | def new |
|
32 | def new |
|
33 | @announcement = Announcement.new |
|
33 | @announcement = Announcement.new |
|
34 |
|
34 | ||
|
35 | respond_to do |format| |
|
35 | respond_to do |format| |
|
36 | format.html # new.html.erb |
|
36 | format.html # new.html.erb |
|
37 | format.xml { render :xml => @announcement } |
|
37 | format.xml { render :xml => @announcement } |
|
38 | end |
|
38 | end |
|
39 | end |
|
39 | end |
|
40 |
|
40 | ||
|
41 | # GET /announcements/1/edit |
|
41 | # GET /announcements/1/edit |
|
42 | def edit |
|
42 | def edit |
|
43 | @announcement = Announcement.find(params[:id]) |
|
43 | @announcement = Announcement.find(params[:id]) |
|
44 | end |
|
44 | end |
|
45 |
|
45 | ||
|
46 | # POST /announcements |
|
46 | # POST /announcements |
|
47 | # POST /announcements.xml |
|
47 | # POST /announcements.xml |
|
48 | def create |
|
48 | def create |
|
49 | @announcement = Announcement.new(params[:announcement]) |
|
49 | @announcement = Announcement.new(params[:announcement]) |
|
50 |
|
50 | ||
|
51 | respond_to do |format| |
|
51 | respond_to do |format| |
|
52 | if @announcement.save |
|
52 | if @announcement.save |
|
53 | flash[:notice] = 'Announcement was successfully created.' |
|
53 | flash[:notice] = 'Announcement was successfully created.' |
|
54 | format.html { redirect_to(@announcement) } |
|
54 | format.html { redirect_to(@announcement) } |
|
55 | format.xml { render :xml => @announcement, :status => :created, :location => @announcement } |
|
55 | format.xml { render :xml => @announcement, :status => :created, :location => @announcement } |
|
56 | else |
|
56 | else |
|
57 | format.html { render :action => "new" } |
|
57 | format.html { render :action => "new" } |
|
58 | format.xml { render :xml => @announcement.errors, :status => :unprocessable_entity } |
|
58 | format.xml { render :xml => @announcement.errors, :status => :unprocessable_entity } |
|
59 | end |
|
59 | end |
|
60 | end |
|
60 | end |
|
61 | end |
|
61 | end |
|
62 |
|
62 | ||
|
63 | # PUT /announcements/1 |
|
63 | # PUT /announcements/1 |
|
64 | # PUT /announcements/1.xml |
|
64 | # PUT /announcements/1.xml |
|
65 | def update |
|
65 | def update |
|
66 | @announcement = Announcement.find(params[:id]) |
|
66 | @announcement = Announcement.find(params[:id]) |
|
67 |
|
67 | ||
|
68 | respond_to do |format| |
|
68 | respond_to do |format| |
|
69 | if @announcement.update_attributes(params[:announcement]) |
|
69 | if @announcement.update_attributes(params[:announcement]) |
|
70 | flash[:notice] = 'Announcement was successfully updated.' |
|
70 | flash[:notice] = 'Announcement was successfully updated.' |
|
71 | format.html { redirect_to(@announcement) } |
|
71 | format.html { redirect_to(@announcement) } |
|
72 | format.js {} |
|
72 | format.js {} |
|
73 | format.xml { head :ok } |
|
73 | format.xml { head :ok } |
|
74 | else |
|
74 | else |
|
75 | format.html { render :action => "edit" } |
|
75 | format.html { render :action => "edit" } |
|
76 | format.js {} |
|
76 | format.js {} |
|
77 | format.xml { render :xml => @announcement.errors, :status => :unprocessable_entity } |
|
77 | format.xml { render :xml => @announcement.errors, :status => :unprocessable_entity } |
|
78 | end |
|
78 | end |
|
79 | end |
|
79 | end |
|
80 | end |
|
80 | end |
|
81 |
|
81 | ||
|
82 | def toggle |
|
82 | def toggle |
|
83 | @announcement = Announcement.find(params[:id]) |
|
83 | @announcement = Announcement.find(params[:id]) |
|
84 |
- @announcement.update_attributes( published: |
|
84 | + @announcement.update_attributes( published: !@announcement.published? ) |
|
85 | respond_to do |format| |
|
85 | respond_to do |format| |
|
86 | format.js {} |
|
86 | format.js {} |
|
87 | end |
|
87 | end |
|
88 | end |
|
88 | end |
|
89 |
|
89 | ||
|
90 | # DELETE /announcements/1 |
|
90 | # DELETE /announcements/1 |
|
91 | # DELETE /announcements/1.xml |
|
91 | # DELETE /announcements/1.xml |
|
92 | def destroy |
|
92 | def destroy |
|
93 | @announcement = Announcement.find(params[:id]) |
|
93 | @announcement = Announcement.find(params[:id]) |
|
94 | @announcement.destroy |
|
94 | @announcement.destroy |
|
95 |
|
95 | ||
|
96 | respond_to do |format| |
|
96 | respond_to do |format| |
|
97 | format.html { redirect_to(announcements_url) } |
|
97 | format.html { redirect_to(announcements_url) } |
|
98 | format.xml { head :ok } |
|
98 | format.xml { head :ok } |
|
99 | end |
|
99 | end |
|
100 | end |
|
100 | end |
|
101 | end |
|
101 | end |
@@ -1,15 +1,15 | |||||
|
1 | <!DOCTYPE html> |
|
1 | <!DOCTYPE html> |
|
2 | %html |
|
2 | %html |
|
3 | %head |
|
3 | %head |
|
4 | %title= GraderConfiguration['contest.name'] |
|
4 | %title= GraderConfiguration['contest.name'] |
|
5 | - = stylesheet_link_tag "application", :media => "all" |
|
5 | + = stylesheet_link_tag "application", params[:controller], :media => "all" |
|
6 | - = javascript_include_tag "application" |
|
6 | + = javascript_include_tag "application", params[:controller] |
|
7 | = csrf_meta_tags |
|
7 | = csrf_meta_tags |
|
8 | = content_for :header |
|
8 | = content_for :header |
|
9 | = yield :head |
|
9 | = yield :head |
|
10 |
|
10 | ||
|
11 | %body |
|
11 | %body |
|
12 | = render 'layouts/header' |
|
12 | = render 'layouts/header' |
|
13 |
|
13 | ||
|
14 | = content_tag(:p,flash[:notice],:style => "color:green") if flash[:notice]!=nil |
|
14 | = content_tag(:p,flash[:notice],:style => "color:green") if flash[:notice]!=nil |
|
15 | = yield |
|
15 | = yield |
@@ -1,27 +1,27 | |||||
|
1 | CafeGrader::Application.routes.draw do |
|
1 | CafeGrader::Application.routes.draw do |
|
2 | root :to => 'main#login' |
|
2 | root :to => 'main#login' |
|
3 |
|
3 | ||
|
4 | get "report/login" |
|
4 | get "report/login" |
|
5 |
|
5 | ||
|
6 | resources :contests |
|
6 | resources :contests |
|
7 |
|
7 | ||
|
8 | resources :announcements |
|
8 | resources :announcements |
|
9 |
- match 'announcements/toggle/:id' => 'announcements#toggle' |
|
9 | + match 'announcements/toggle/:id' => 'announcements#toggle' |
|
10 |
|
10 | ||
|
11 | resources :sites |
|
11 | resources :sites |
|
12 |
|
12 | ||
|
13 | resources :grader_configuration, controller: 'configurations' |
|
13 | resources :grader_configuration, controller: 'configurations' |
|
14 |
|
14 | ||
|
15 | match 'tasks/view/:file.:ext' => 'tasks#view' |
|
15 | match 'tasks/view/:file.:ext' => 'tasks#view' |
|
16 | match 'tasks/download/:id/:file.:ext' => 'tasks#download' |
|
16 | match 'tasks/download/:id/:file.:ext' => 'tasks#download' |
|
17 | match 'heartbeat/:id/edit' => 'heartbeat#edit' |
|
17 | match 'heartbeat/:id/edit' => 'heartbeat#edit' |
|
18 |
|
18 | ||
|
19 | #main |
|
19 | #main |
|
20 | get "main/list" |
|
20 | get "main/list" |
|
21 |
|
21 | ||
|
22 | # See how all your routes lay out with "rake routes" |
|
22 | # See how all your routes lay out with "rake routes" |
|
23 |
|
23 | ||
|
24 | # This is a legacy wild controller route that's not recommended for RESTful applications. |
|
24 | # This is a legacy wild controller route that's not recommended for RESTful applications. |
|
25 | # Note: This route will make all actions in every controller accessible via GET requests. |
|
25 | # Note: This route will make all actions in every controller accessible via GET requests. |
|
26 | match ':controller(/:action(/:id))(.:format)' |
|
26 | match ':controller(/:action(/:id))(.:format)' |
|
27 | end |
|
27 | end |
deleted file |
You need to be logged in to leave comments.
Login now