Permalink
Browse files

Allows to mark activity items as reviewed

  • Loading branch information...
1 parent d9cc857 commit 29af7a8a82733979185aabce9fed7b764e0ba7a8 @Ferdev Ferdev committed Apr 17, 2012
@@ -6,6 +6,12 @@ class Admin::ActivitiesController < Admin::AdminController
def show
end
+ def update
+ change = ChangesHistoryRecord.find(params[:id])
+ change.update_attributes!(params[:changes_history_record])
+ redirect_to admin_activity_path
+ end
+
def get_search_params
search_params = {
'who' => nil,
@@ -17,6 +17,10 @@
<p class="title"><%= t('.header.changes_count_all_html', :count => change.changes_count, :what => link_to(truncate(change.what_name, :length => 70), edit_admin_project_path(change.what), :title => change.what_name)) %></p>
<% end -%>
<p class="by"><%= t('.header.by_html', :user => change.who_email, :organization => link_to(truncate(change.who_organization_name, :length => 26), url_for_user_organization(change.who_organization), :title => change.who_organization_name)) %></p>
+ <%= form_for change, :url => admin_changes_history_record_path(change.id) do |f| %>
+ <%= f.label :reviewed %>
+ <%= f.check_box :reviewed %>
+ <% end -%>
</div>
<div class="more">
View
@@ -87,6 +87,7 @@
resources :pages
end
resource :activity
+ resources :changes_history_records, :controller => "activities"
end
end
@@ -0,0 +1,9 @@
+class AddReviewedFieldToChangesHistoryRecords < ActiveRecord::Migration
+ def self.up
+ add_column :changes_history_records, :reviewed, :boolean, :default => false
+ end
+
+ def self.down
+ remove_column :changes_history_records, :reviewed
+ end
+end
View
@@ -10,7 +10,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20120214152607) do
+ActiveRecord::Schema.define(:version => 20120417111053) do
create_table "changes_history_records", :force => true do |t|
t.integer "user_id"
@@ -20,6 +20,7 @@
t.datetime "updated_at"
t.integer "what_id"
t.string "what_type"
+ t.boolean "reviewed", :default => false
end
create_table "clusters", :force => true do |t|
@@ -37,13 +38,13 @@
create_table "countries", :force => true do |t|
t.string "name"
t.string "code"
- t.float "center_lat"
- t.float "center_lon"
t.multi_polygon "the_geom", :limit => nil, :srid => 4326
t.string "wiki_url"
t.text "wiki_description"
t.string "iso2_code"
t.string "iso3_code"
+ t.float "center_lat"
+ t.float "center_lon"
t.text "the_geom_geojson"
end
@@ -81,21 +82,15 @@
add_index "data_denormalization", ["cluster_ids"], :name => "data_denormalization_cluster_idsx"
add_index "data_denormalization", ["countries_ids"], :name => "data_denormalization_countries_idsx"
- add_index "data_denormalization", ["created_at"], :name => "index_data_denormalization_on_created_at"
add_index "data_denormalization", ["donors_ids"], :name => "data_denormalization_donors_idsx"
add_index "data_denormalization", ["is_active"], :name => "data_denormalization_is_activex"
- add_index "data_denormalization", ["is_active"], :name => "index_data_denormalization_on_is_active"
add_index "data_denormalization", ["organization_id"], :name => "data_denormalization_organization_idx"
- add_index "data_denormalization", ["organization_id"], :name => "index_data_denormalization_on_organization_id"
add_index "data_denormalization", ["organization_name"], :name => "data_denormalization_organization_namex"
add_index "data_denormalization", ["project_id"], :name => "data_denormalization_project_idx"
- add_index "data_denormalization", ["project_id"], :name => "index_data_denormalization_on_project_id"
add_index "data_denormalization", ["project_name"], :name => "data_denormalization_project_name_idx"
- add_index "data_denormalization", ["project_name"], :name => "index_data_denormalization_on_project_name"
add_index "data_denormalization", ["regions_ids"], :name => "data_denormalization_regions_idsx"
add_index "data_denormalization", ["sector_ids"], :name => "data_denormalization_sector_idsx"
add_index "data_denormalization", ["site_id"], :name => "data_denormalization_site_idx"
- add_index "data_denormalization", ["site_id"], :name => "index_data_denormalization_on_site_id"
create_table "data_export", :id => false, :force => true do |t|
t.integer "project_id"
@@ -413,16 +408,16 @@
t.integer "level"
t.integer "country_id"
t.integer "parent_region_id"
- t.float "center_lat"
- t.float "center_lon"
- t.string "path"
t.geometry "the_geom", :limit => nil, :srid => 4326
t.integer "gadm_id"
t.string "wiki_url"
t.text "wiki_description"
t.string "code"
+ t.float "center_lat"
+ t.float "center_lon"
t.text "the_geom_geojson"
t.text "ia_name"
+ t.string "path"
end
add_index "regions", ["country_id"], :name => "index_regions_on_country_id"
@@ -2,7 +2,7 @@ $(document).ready(function(ev){
var hasChanged = [];
- hasChanged['start'] = false;
+ hasChanged['start'] = false;
hasChanged['end'] = false;
function isBlank(str) {
@@ -34,7 +34,7 @@ $(document).ready(function(ev){
var kind = (id.indexOf("end") != -1) ? "end" : "start";
$('span.combo_date:not(.open)').removeClass('clicked');
-
+
if (hasChanged[kind] && allSelected(kind)) {
$('form').closest('form').submit();
@@ -101,5 +101,13 @@ $(document).ready(function(ev){
change.find('.detail').slideToggle();
}
});
+
+ $('.changes_list .change form input#changes_history_record_reviewed').change(function(evt){
+ evt.preventDefault();
+ console.log($(this).is(':checked'));
+ if ($(this).is(':checked')){
+ $(this).closest('form').submit();
+ }
+ });
});
@@ -1389,6 +1389,11 @@ div.med div.changes_list div.change .summary .title_by .by{
color: #999999;
}
+div.med div.changes_list div.change .summary .title_by form {
+ color: black;
+ text-align: right;
+}
+
div.med div.changes_list div.change .summary .more {
height: 37px;
width: 60px;

0 comments on commit 29af7a8

Please sign in to comment.