From e51cf148d2a5910c224f34c5448070f122e75c1f Mon Sep 17 00:00:00 2001 From: gopesht Date: Sun, 9 Mar 2014 02:33:49 +0530 Subject: [PATCH 1/3] Check for call_for_papers object. When call_for_papers object is nil then the previous check throws an error for check at line no 16. So I modified the check to see that first the call_for papers object exsist for current conference object an the rest follow. --- app/views/admin/events/index.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/admin/events/index.html.haml b/app/views/admin/events/index.html.haml index fc50cbbe..04d8267a 100644 --- a/app/views/admin/events/index.html.haml +++ b/app/views/admin/events/index.html.haml @@ -13,7 +13,7 @@ %b ID %th %b Title - - if @conference.call_for_papers.rating != 0 + - if !@conference.call_for_papers.blank? && @conference.call_for_papers.rating != 0 %th %b Rating %th From ad544a117f5952c82d5086bd25d9c63d246fc427 Mon Sep 17 00:00:00 2001 From: Gopesh Tulsyan Date: Sun, 9 Mar 2014 11:58:57 +0530 Subject: [PATCH 2/3] Admin able to delete every other user except admins(feature) --- app/controllers/admin/users_controller.rb | 11 +++++++++++ app/views/admin/users/index.html.haml | 7 +++++++ 2 files changed, 18 insertions(+) diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb index b30b1598..8ccd0882 100644 --- a/app/controllers/admin/users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -16,4 +16,15 @@ class Admin::UsersController < ApplicationController user.update_attributes!(params[:user]) redirect_to admin_users_path, :notice => "Updated #{user.email}" end + + def delete + @user = User.find(params[:id]) + end + + def destroy + @user = User.find(params[:id]) + @user.destroy + redirect_to admin_users_path, :notice => "User got deleted" + + end end \ No newline at end of file diff --git a/app/views/admin/users/index.html.haml b/app/views/admin/users/index.html.haml index 030ed138..74a8ffe4 100644 --- a/app/views/admin/users/index.html.haml +++ b/app/views/admin/users/index.html.haml @@ -24,6 +24,7 @@ %b Roles %th %th + %th - @users.each do |user| - person = Person.find_person_by_user_id(user.id) %tr @@ -71,6 +72,12 @@ "data-html" => "true", "data-content" => user.popup_details, "data-original-title" => "" + + %td + - if current_user.id == user.id or user.role_ids.include? 3 + =link_to 'Delete',admin_user_path(user), :method => :delete , :data => {:confirm => 'Are you sure ?'}, :disabled => true,:class => "btn btn-primary disabled btn-danger",:role => "button" + - else + =link_to 'Delete',admin_user_path(user), :method=> :delete , :data=> {:confirm => 'Are you sure ?'},:class => "btn btn-primary btn-danger" :javascript $(document).ready(function() { From 521d2dc72f725d311a32277774c56a40933e98a2 Mon Sep 17 00:00:00 2001 From: Gopesh Tulsyan Date: Mon, 17 Mar 2014 17:41:31 +0530 Subject: [PATCH 3/3] Unnecessary migration and invalid syntax in migraton --- Gemfile | 2 +- Gemfile.lock | 2 -- .../20130515125823_change_attachment_default.rb | 4 ++-- .../20130515131210_drop_additional_speakers.rb | 9 --------- db/schema.rb | 16 ++++++++-------- 5 files changed, 11 insertions(+), 22 deletions(-) delete mode 100644 db/migrate/20130515131210_drop_additional_speakers.rb diff --git a/Gemfile b/Gemfile index 4df6a25f..d8373945 100644 --- a/Gemfile +++ b/Gemfile @@ -20,7 +20,7 @@ end group :development, :test do gem 'pry' - gem 'sqlite3' + gem 'mysql2' gem 'thin' gem 'rspec-rails', '2.11.0' end diff --git a/Gemfile.lock b/Gemfile.lock index d4ac419f..ac0dd53c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -192,7 +192,6 @@ GEM multi_json (~> 1.0) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) - sqlite3 (1.3.8) therubyracer (0.12.0) libv8 (~> 3.16.14.0) ref @@ -246,7 +245,6 @@ DEPENDENCIES rails (= 3.2.15) rspec-rails (= 2.11.0) sass-rails (~> 3.2.3) - sqlite3 therubyracer thin transitions diff --git a/db/migrate/20130515125823_change_attachment_default.rb b/db/migrate/20130515125823_change_attachment_default.rb index 562f76b4..bf1a4f88 100644 --- a/db/migrate/20130515125823_change_attachment_default.rb +++ b/db/migrate/20130515125823_change_attachment_default.rb @@ -1,8 +1,8 @@ class ChangeAttachmentDefault < ActiveRecord::Migration def up - change_column_default(:event_attachments, :public, :default => true) + change_column_default(:event_attachments, :public, true) end def down - change_column_default(:event_attachments, :public, :default => nil) + change_column_default(:event_attachments, :public, true) end end diff --git a/db/migrate/20130515131210_drop_additional_speakers.rb b/db/migrate/20130515131210_drop_additional_speakers.rb deleted file mode 100644 index a6332cd3..00000000 --- a/db/migrate/20130515131210_drop_additional_speakers.rb +++ /dev/null @@ -1,9 +0,0 @@ -class DropAdditionalSpeakers < ActiveRecord::Migration - def up - remove_column :registrations, :additional_speakers - end - - def down - add_column :registrations, :additional_speakers - end -end diff --git a/db/schema.rb b/db/schema.rb index 0632d711..119381f6 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -118,14 +118,14 @@ ActiveRecord::Schema.define(:version => 20140305102505) do create_table "event_attachments", :force => true do |t| t.integer "event_id" - t.string "title", :null => false + t.string "title", :null => false t.string "attachment_file_name" t.string "attachment_content_type" t.integer "attachment_file_size" t.datetime "attachment_updated_at" - t.boolean "public", :default => false - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.boolean "public", :default => true + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false end create_table "event_people", :force => true do |t| @@ -347,14 +347,14 @@ ActiveRecord::Schema.define(:version => 20140305102505) do create_table "venues", :force => true do |t| t.string "guid" - t.text "name", :limit => 255 - t.text "address", :limit => 255 + t.text "name" + t.text "address" t.string "website" t.text "description" t.string "offline_map_url" t.string "offline_map_bounds" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false end create_table "versions", :force => true do |t|