# HG changeset patch # User Nattee Niparnan # Date 2017-05-16 06:40:14 # Node ID 72b80e42fb9b26176c5508f2756efbe0c023ca6e # Parent 3cb38436f7f6d5c6d4490038e78576c39b58135e - bootstrapize problem/edit - bootstrapize announcement/edit diff --git a/app/controllers/main_controller.rb b/app/controllers/main_controller.rb --- a/app/controllers/main_controller.rb +++ b/app/controllers/main_controller.rb @@ -88,10 +88,10 @@ if @submission.valid? if @submission.save == false - flash[:notice] = 'Error saving your submission' + flash[:notice] = 'Error saving your submission' elsif Task.create(:submission_id => @submission.id, :status => Task::STATUS_INQUEUE) == false - flash[:notice] = 'Error adding your submission to task queue' + flash[:notice] = 'Error adding your submission to task queue' end else prepare_list_information @@ -106,7 +106,7 @@ (submission.problem != nil) and (submission.problem.available)) send_data(submission.source, - {:filename => submission.download_filename, + {:filename => submission.download_filename, :type => 'text/plain'}) else flash[:notice] = 'Error viewing source' diff --git a/app/views/announcements/edit.html.erb b/app/views/announcements/edit.html.erb deleted file mode 100644 --- a/app/views/announcements/edit.html.erb +++ /dev/null @@ -1,47 +0,0 @@ -

Editing announcement

- -<%= error_messages_for :announcement %> - -<%= form_for(@announcement) do |f| %> -

- Title
- <%= f.text_field :title %> -

- -

- Notes (shown internally, used to organize announcements)
- <%= f.text_field :notes %> -

- -

- Body
- <%= f.text_area :body %> -

- -

- Author
- <%= f.text_field :author %> -

- -

- Published
- <%= f.check_box :published %> -

- -

- Show on front page?
- <%= f.check_box :frontpage %> -

- -

- Show only in contest?
- <%= f.check_box :contest_only %> -

- -

- <%= f.submit "Update" %> -

-<% end %> - -<%= link_to 'Show', @announcement %> | -<%= link_to 'Back', announcements_path %> diff --git a/app/views/problems/_form.html.erb b/app/views/problems/_form.html.erb deleted file mode 100644 --- a/app/views/problems/_form.html.erb +++ /dev/null @@ -1,55 +0,0 @@ -<%= error_messages_for 'problem' %> - - -


-<%= text_field 'problem', 'name' %> Do not directly edit the problem name, unless you know what you are doing. If you want to change the name, use the name change button in the problem management menu instead. -

- -


-<%= text_field 'problem', 'full_name' %>

- -


-<%= text_field 'problem', 'full_score' %>

- -


-<%= date_select 'problem', 'date_added' %>

- -<% -# TODO: these should be put in model Problem, but I can't think of -# nice default values for them. These values look fine only -# in this case (of lazily adding new problems). -@problem.available = true if @problem!=nil and @problem.available==nil -@problem.test_allowed = true if @problem!=nil and @problem.test_allowed==nil -@problem.output_only = false if @problem!=nil and @problem.output_only==nil -%> - -

- -<%= check_box :problem, :available %> - - -<%= check_box :problem, :test_allowed %> - - -<%= check_box :problem, :output_only %> -

- -<%= error_messages_for 'description' %> - -


-<%= text_area :description, :body, :rows => 10, :cols => 80 %>

- -

-<%= select "description", - "markdowned", - [['True',true],['False',false]], - {:selected => (@description) ? @description.markdowned : false } -%>

- -


-<%= text_field 'problem', 'url' %>

- -

Task PDF <%= file_field_tag 'file' %>

- - - diff --git a/app/views/problems/edit.html.erb b/app/views/problems/edit.html.erb deleted file mode 100644 --- a/app/views/problems/edit.html.erb +++ /dev/null @@ -1,9 +0,0 @@ -

Editing problem

- -<%= form_for @problem,url:{action: 'update'},html: {multipart: true} do %> - <%= render :partial => 'form' %> - <%= submit_tag 'Edit' %> -<% end %> - -<%= link_to 'Show', :action => 'show', :id => @problem %> | -<%= link_to 'Back', problems_path %> diff --git a/app/views/submissions/edit.html.haml b/app/views/submissions/edit.html.haml --- a/app/views/submissions/edit.html.haml +++ b/app/views/submissions/edit.html.haml @@ -1,7 +1,7 @@ %h2 Live submit %br -%textarea#text_haha{style: "display:none"}~ @source +%textarea#text_sourcecode{style: "display:none"}~ @source .container .row .col-md-12 @@ -41,7 +41,7 @@ :javascript $(document).ready(function() { e = ace.edit("editor") - e.setValue($("#text_haha").val()); + e.setValue($("#text_sourcecode").val()); e.gotoLine(1); $("#language_id").trigger('change'); brython();