# HG changeset patch # User jittat # Date 2009-08-16 11:18:07 # Node ID e9aaeb17b5bce26af65bfa6bbd441f658a6ed179 # Parent f7680fc5e3dde50df0ccb4b6035c9e9653c7080f better announcement effects git-svn-id: http://theory.cpe.ku.ac.th/grader/web/trunk@413 6386c4cd-e34a-4fa8-8920-d93eb39b512e diff --git a/app/views/announcements/edit.html.erb b/app/views/announcements/edit.html.erb --- a/app/views/announcements/edit.html.erb +++ b/app/views/announcements/edit.html.erb @@ -4,6 +4,11 @@ <% form_for(@announcement) do |f| %>

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

+ +

Body
<%= f.text_area :body %>

diff --git a/app/views/announcements/index.html.erb b/app/views/announcements/index.html.erb --- a/app/views/announcements/index.html.erb +++ b/app/views/announcements/index.html.erb @@ -8,6 +8,7 @@ + @@ -16,6 +17,7 @@ <% for announcement in @announcements %> <% @announcement = announcement %> + diff --git a/app/views/announcements/new.html.erb b/app/views/announcements/new.html.erb --- a/app/views/announcements/new.html.erb +++ b/app/views/announcements/new.html.erb @@ -4,6 +4,11 @@ <% form_for(@announcement) do |f| %>

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

+ +

Body
<%= f.text_area :body %>

diff --git a/app/views/announcements/show.html.erb b/app/views/announcements/show.html.erb --- a/app/views/announcements/show.html.erb +++ b/app/views/announcements/show.html.erb @@ -4,6 +4,11 @@

+ Title: + <%=h @announcement.title %> +

+ +

Body: <%=h @announcement.body %>

diff --git a/app/views/main/_announcement.html.haml b/app/views/main/_announcement.html.haml --- a/app/views/main/_announcement.html.haml +++ b/app/views/main/_announcement.html.haml @@ -1,17 +1,19 @@ -.announcement{:id => "announcement-#{announcement.id}", :style => "#{'opacity: 0;' if (defined? announcement_effect) and announcement_effect }"} - -# .announcement-title - -# .toggles - -# %a{:href => '#', :onclick => "$(\"announcement-body-#{announcement.id}\").hide(); return false;"} - -# [hide] - -# %a{:href => '#', :onclick => "$(\"announcement-body-#{announcement.id}\").show(); return false;"} - -# [show] - -# Announcement Title - .announcement-body{:id => "announcement-body-#{announcement.id}"} - = markdown(announcement.body) - -#.pub-info - -# %p= "#{announcement.author}, #{announcement.created_at}" - :javascript - Announcement.updateRecentId(#{announcement.id}); - - if (defined? announcement_effect) and announcement_effect +.announcement{:id => "announcement-#{announcement.id}", :style => "#{'display: none; opacity: 0' if (defined? announcement_effect) and announcement_effect }"} + %div + .announcement-title + -# .toggles + -# %a{:href => '#', :onclick => "$(\"announcement-body-#{announcement.id}\").blindUp({duration: 0.2}); return false;"} + -# [hide] + -# %a{:href => '#', :onclick => "$(\"announcement-body-#{announcement.id}\").blindDown({duration: 0.2}); return false;"} + -# [show] + = announcement.title + .announcement-body{:id => "announcement-body-#{announcement.id}"} + = markdown(announcement.body) + -#.pub-info + -# %p= "#{announcement.author}, #{announcement.created_at}" :javascript - $("announcement-#{announcement.id}").appear(); + Announcement.updateRecentId(#{announcement.id}); + - if (defined? announcement_effect) and announcement_effect + :javascript + $("announcement-#{announcement.id}").blindDown({duration: 0.2}); + $("announcement-#{announcement.id}").appear({duration: 0.5, queue: 'end'}); diff --git a/db/migrate/20090815171610_add_title_to_announcements.rb b/db/migrate/20090815171610_add_title_to_announcements.rb new file mode 100644 --- /dev/null +++ b/db/migrate/20090815171610_add_title_to_announcements.rb @@ -0,0 +1,9 @@ +class AddTitleToAnnouncements < ActiveRecord::Migration + def self.up + add_column :announcements, :title, :string + end + + def self.down + remove_column :announcements, :title + end +end diff --git a/db/schema.rb b/db/schema.rb --- a/db/schema.rb +++ b/db/schema.rb @@ -9,7 +9,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20090426131044) do +ActiveRecord::Schema.define(:version => 20090815171610) do create_table "announcements", :force => true do |t| t.string "author" @@ -19,6 +19,7 @@ t.datetime "updated_at" t.boolean "frontpage", :default => false t.boolean "contest_only", :default => false + t.string "title" end create_table "configurations", :force => true do |t| @@ -42,6 +43,18 @@ t.datetime "updated_at" end + create_table "grader_messages", :force => true do |t| + t.integer "grader_process_id" + t.integer "command" + t.string "options" + t.integer "target_id" + t.boolean "accepted" + t.boolean "completed" + t.integer "accepting_grader_process_id" + t.datetime "created_at" + t.datetime "updated_at" + end + create_table "grader_processes", :force => true do |t| t.string "host", :limit => 20 t.integer "pid"
Title Body Author Published
<%=h announcement.title %> <%=h announcement.body %> <%=h announcement.author %> <%= in_place_editor_field :announcement, :published, {}, :rows => 1 %>