From e70f95d7a424f760ec14903601ad5ede59e541d1 Mon Sep 17 00:00:00 2001 From: Rishi Jain Date: Mon, 28 May 2012 11:55:24 +0530 Subject: [PATCH 01/14] added "not interested" link once user clicks on interested updated the count of participants as user clicks on interested/not interested --- app/controllers/ideas_controller.rb | 7 ++++++- app/views/ideas/_idea.html.haml | 9 +++++++-- app/views/ideas/_link_for_participate.html.haml | 2 ++ app/views/ideas/_link_for_un_participate.html.haml | 3 +++ app/views/ideas/_participants_count.html.haml | 2 ++ app/views/ideas/not_interested.js.haml | 4 ++++ app/views/ideas/participate.js.haml | 5 ++++- config/routes.rb | 1 + db/schema.rb | 2 +- 9 files changed, 30 insertions(+), 5 deletions(-) create mode 100644 app/views/ideas/_link_for_participate.html.haml create mode 100644 app/views/ideas/_link_for_un_participate.html.haml create mode 100644 app/views/ideas/_participants_count.html.haml create mode 100644 app/views/ideas/not_interested.js.haml diff --git a/app/controllers/ideas_controller.rb b/app/controllers/ideas_controller.rb index 9e6fd99..893043c 100644 --- a/app/controllers/ideas_controller.rb +++ b/app/controllers/ideas_controller.rb @@ -1,6 +1,6 @@ class IdeasController < ApplicationController before_filter :authenticate_user!, :except => [:index, :show] - before_filter :get_idea, :only => [:update, :edit, :show, :participate] + before_filter :get_idea, :only => [:update, :edit, :show, :participate, :not_interested] def show redirect_to ideas_path @@ -47,6 +47,11 @@ def participate end end + def not_interested + idea_user = IdeaUser.where(:user_id => current_user.id, :idea_id => @idea.id).first + idea_user.destroy unless idea_user.nil? + end + private def get_idea @idea = Idea.find_by_id(params[:id]) diff --git a/app/views/ideas/_idea.html.haml b/app/views/ideas/_idea.html.haml index 814e776..63ef7ae 100644 --- a/app/views/ideas/_idea.html.haml +++ b/app/views/ideas/_idea.html.haml @@ -7,7 +7,11 @@ %span= raw idea.description.truncate(200) = link_to 'Details', "#idea-detail-#{idea.id}", class: 'details btn btn-info', data: {toggle: 'modal'} - unless idea.users.include?(current_user) - = link_to 'Participate', participate_idea_path(idea), :class => 'participate btn btn-info', :remote => true + %div{:id => "add_not_interested_link_#{idea.id}"} + = link_to 'Participate', participate_idea_path(idea), :class => 'participate btn btn-info', :id => "participate_#{idea.id}", :remote => true + - else + %div{:id => "add_participate_link_#{idea.id}"} + = link_to 'Not Interested', not_interested_idea_path(idea), :class => 'participate btn btn-info', :id => "not_interested_#{idea.id}", :remote => true %span.detail %span %i.icon-calendar> @@ -15,7 +19,8 @@ | %span %i.icon-user> - = pluralize(idea.users.count, "participant") + %span{:id => "participants_count_#{idea.id}"} + = pluralize(idea.users.count, "participant") .modal{style: "display:none", id: "idea-detail-#{idea.id}"} .modal-header diff --git a/app/views/ideas/_link_for_participate.html.haml b/app/views/ideas/_link_for_participate.html.haml new file mode 100644 index 0000000..ea33531 --- /dev/null +++ b/app/views/ideas/_link_for_participate.html.haml @@ -0,0 +1,2 @@ +%div{:id => "add_not_interested_link_#{@idea.id}"} + = link_to 'Participate', participate_idea_path(@idea), :class => 'participate btn btn-info', :id => "participate_#{@idea.id}", :remote => true diff --git a/app/views/ideas/_link_for_un_participate.html.haml b/app/views/ideas/_link_for_un_participate.html.haml new file mode 100644 index 0000000..ee3d8a2 --- /dev/null +++ b/app/views/ideas/_link_for_un_participate.html.haml @@ -0,0 +1,3 @@ +%div{:id => "add_participate_link_#{@idea.id}"} + = link_to 'Not Interested', not_interested_idea_path(@idea), :class => 'participate btn btn-info', :id => "not_interested_#{@idea.id}", :remote => true + diff --git a/app/views/ideas/_participants_count.html.haml b/app/views/ideas/_participants_count.html.haml new file mode 100644 index 0000000..79c210e --- /dev/null +++ b/app/views/ideas/_participants_count.html.haml @@ -0,0 +1,2 @@ +%span{:id => "participants_count_#{@idea.id}"} + = pluralize(@idea.users.count, "participant") diff --git a/app/views/ideas/not_interested.js.haml b/app/views/ideas/not_interested.js.haml new file mode 100644 index 0000000..f36817d --- /dev/null +++ b/app/views/ideas/not_interested.js.haml @@ -0,0 +1,4 @@ +$('#idea-#{@idea.id} a h2 i').removeClass('favorite') +$('#add_participate_link_#{@idea.id}').html("#{escape_javascript(render :partial => 'ideas/link_for_participate')}") +$('#participants_count_#{@idea.id}').html("#{escape_javascript(render :partial => 'ideas/participants_count')}") + diff --git a/app/views/ideas/participate.js.haml b/app/views/ideas/participate.js.haml index 35f4537..738c5dd 100644 --- a/app/views/ideas/participate.js.haml +++ b/app/views/ideas/participate.js.haml @@ -1,3 +1,6 @@ +$('#idea-#{@idea.id} h3').text("#{pluralize(@idea.users.count, "participant")}") $('#idea-#{@idea.id} a h2 i').addClass('favorite') $('#idea-#{@idea.id} a.participate.btn').remove() -$('#idea-#{@idea.id} h3').html("#{pluralize(@idea.users.count, "participant")}") +$('#add_not_interested_link_#{@idea.id}').html("#{escape_javascript(render :partial => 'ideas/link_for_un_participate')}") +$('#participants_count_#{@idea.id}').html("#{escape_javascript(render :partial => 'ideas/participants_count')}") + diff --git a/config/routes.rb b/config/routes.rb index 07cfbdb..0d90326 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -18,6 +18,7 @@ resources :ideas do get 'participate', :on => :member + get 'not_interested', :on => :member resources :schedules end diff --git a/db/schema.rb b/db/schema.rb index f71c2c9..cbf33f0 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20120521112817) do +ActiveRecord::Schema.define(:version => 20120521120228) do create_table "categories", :force => true do |t| t.string "name" From aa2b80a7ceda370fdb3429ce852b40236efc6c0c Mon Sep 17 00:00:00 2001 From: rtdp Date: Fri, 15 Jun 2012 19:03:07 +0530 Subject: [PATCH 02/14] seed improved for adding 5 users n 10 ideas randomly --- db/seeds.rb | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/db/seeds.rb b/db/seeds.rb index ec3fd78..b60627a 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -10,9 +10,24 @@ %w{Ruby Javascript Rails CMS CRM Testing Nodejs Gem Api }.collect { |c| { name: c } } ) -Setting.consumer_key = 'your twitter consumer key' -Setting.consumer_secret = 'your twitter consumer secret' -Setting.oauth_token = 'your twitter access token' -Setting.oauth_token_secret = 'your twitter access token secret' +Setting.consumer_key = 'your consumer key here' +Setting.consumer_secret = 'your consumer secret here.' +#Setting.oauth_token = 'your twitter access token' +#Setting.oauth_token_secret = 'your twitter access token secret' +5.times do |i| + User.create({name: "test#{i}", email: "test#{i}@testers.com", screen_name: "testers#{i}"}) +end + +10.times do |i| + idea = Idea.new({ + title: "Idea title#{i}", + description: "a. A integer. Et? Est diam ridiculus mattis scelerisque, scelerisque cras, in ultricies? Ultricies sociis velit quis scelerisque sit scelerisque cum diam a odio adipiscing? Duis egestas et sociis. Nec sed porttitor, pulvinar eros integer a aenean sociis placerat? Elit aliquam. Quis quis cum sit in velit? Massa duis sociis mus porta? ", + github: 'http://github.com/something/#{i}', + original_desc: "a. A integer. Et? Est diam ridiculus mattis scelerisque, scelerisque cras, in ultricies? Ultricies sociis velit quis scelerisque sit scelerisque cum diam a odio adipiscing? Duis egestas et sociis. Nec sed porttitor, pulvinar eros integer a aenean sociis placerat? Elit aliquam. Quis quis cum sit in velit? Massa duis sociis mus porta? " + }) + idea.user = User.all.shuffle.first + idea.save +end + From b40094abc2cf94f2bac5e852927f1cfe3d87303c Mon Sep 17 00:00:00 2001 From: rtdp Date: Fri, 15 Jun 2012 19:04:47 +0530 Subject: [PATCH 03/14] attr-accessible changes for idea model --- app/models/idea.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/idea.rb b/app/models/idea.rb index 5eeda8a..6a02289 100644 --- a/app/models/idea.rb +++ b/app/models/idea.rb @@ -8,8 +8,8 @@ class Idea < ActiveRecord::Base has_many :categories, :through => :idea_categories validates :user_id, :title, :original_desc, :presence => true - - attr_accessible :title, :original_desc, :user_id, :category_ids, :github + + attr_accessible :title, :original_desc, :user_id, :category_ids, :github, :description before_save :format_description From 48cd71ed5d80565664b5dd5b298ce5b6a1ec043a Mon Sep 17 00:00:00 2001 From: rtdp Date: Fri, 15 Jun 2012 19:16:11 +0530 Subject: [PATCH 04/14] fix for issue #66 --- app/assets/stylesheets/application.css.sass | 5 +++++ app/models/idea.rb | 2 ++ app/views/ideas/_idea.html.haml | 10 ++++++++-- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/app/assets/stylesheets/application.css.sass b/app/assets/stylesheets/application.css.sass index 4a9c952..102624a 100644 --- a/app/assets/stylesheets/application.css.sass +++ b/app/assets/stylesheets/application.css.sass @@ -51,3 +51,8 @@ input.span8, .uneditable-input.span8 .row margin-left: 0px !important +.marTop5 + margin-top: 5px + +.marTop10 + margin-top: 10px diff --git a/app/models/idea.rb b/app/models/idea.rb index 6a02289..055ab11 100644 --- a/app/models/idea.rb +++ b/app/models/idea.rb @@ -13,6 +13,8 @@ class Idea < ActiveRecord::Base before_save :format_description + delegate :name, to: :user, prefix: true + def format_description self.description = RedCloth.new(original_desc, [:lite_mode]).to_html end diff --git a/app/views/ideas/_idea.html.haml b/app/views/ideas/_idea.html.haml index bfc17a9..25e7cdb 100644 --- a/app/views/ideas/_idea.html.haml +++ b/app/views/ideas/_idea.html.haml @@ -25,8 +25,14 @@ %h3= idea.title .modal-body %h6= idea.categories.collect(&:name).join(', ') - %h5= link_to idea.github, idea.github, target: '_blank' - %br/ + %h5 + Github URL: + = link_to idea.github, idea.github, target: '_blank' + %h5.marTop10 + Idea By: + = idea.user_name + %h5.marTop10 + Description %p= raw idea.description .modal-footer = participate_button(idea) From 79ad95ad9c19dad5f8d299d691e8a4b8f71066e0 Mon Sep 17 00:00:00 2001 From: rtdp Date: Fri, 15 Jun 2012 19:22:26 +0530 Subject: [PATCH 05/14] fix added for #64 --- app/helpers/ideas_helper.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/helpers/ideas_helper.rb b/app/helpers/ideas_helper.rb index 9673702..dc6dac1 100644 --- a/app/helpers/ideas_helper.rb +++ b/app/helpers/ideas_helper.rb @@ -9,8 +9,12 @@ def display_categories(idea) end def participate_button(idea) - participant = idea.users.include?(current_user) ? 'Leave' : 'Participate' - link_to participant, participate_idea_path(idea), :class => 'participate btn btn-info', :remote => true + if user_signed_in? + participant = idea.users.include?(current_user) ? 'Leave' : 'Participate' + link_to participant, participate_idea_path(idea), :class => 'participate btn btn-info', :remote => true + else + link_to 'Participate', participate_idea_path(idea), :class => 'participate btn btn-info', onclick: "alert('You need to login with twitter to participate.'); return false;" + end end def display_participants(idea) From 846626193a9a55b1c7c90de2f1e73de408a28850 Mon Sep 17 00:00:00 2001 From: rtdp Date: Fri, 15 Jun 2012 19:39:08 +0530 Subject: [PATCH 06/14] fix for #75 --- app/assets/stylesheets/style.css.sass | 8 +++++++- app/views/ideas/_idea.html.haml | 6 +++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/app/assets/stylesheets/style.css.sass b/app/assets/stylesheets/style.css.sass index b0a410a..a659f01 100644 --- a/app/assets/stylesheets/style.css.sass +++ b/app/assets/stylesheets/style.css.sass @@ -139,7 +139,7 @@ input.span8, .uneditable-input.span8 margin-left: 55px .detail font-weight: bold - margin-left: 10px + margin: 10px font-size: 12px height: 25px span @@ -165,3 +165,9 @@ input.span8, .uneditable-input.span8 margin: -330px 0 0 -285px width: 575px text-align: center + +div.floatLeft + float: left + +div.floatRight + float: right diff --git a/app/views/ideas/_idea.html.haml b/app/views/ideas/_idea.html.haml index 25e7cdb..1b3f2fe 100644 --- a/app/views/ideas/_idea.html.haml +++ b/app/views/ideas/_idea.html.haml @@ -8,15 +8,15 @@ %span= raw idea.description.truncate(140) = link_to 'Overview', "#idea-detail-#{idea.id}", class: 'details btn btn-info', data: {toggle: 'modal'} .detail - %span + .floatLeft %i.icon-calendar> = idea.schedules.last.try(:scheduled_at).try(:idea_date) or "soon" | - %span + .floatLeft %i.icon-user> =# pluralize(idea.users.count, "participant") = idea.users.count - %span + .floatRight = tweet_button :via => "joshideahub",:count=> "none", :url => idea_url(idea), :text => "This is an interesting idea! Help out " .modal{style: "display:none", id: "idea-detail-#{idea.id}"} From c8986fb2842b170888a41a07761a4ee963e874ee Mon Sep 17 00:00:00 2001 From: rtdp Date: Fri, 15 Jun 2012 19:45:39 +0530 Subject: [PATCH 07/14] seed improved to add categories to the ideas --- db/seeds.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/db/seeds.rb b/db/seeds.rb index b60627a..82cb6c6 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -31,3 +31,7 @@ idea.save end +20.times do |i| + ## Randomly assign few categories to the few ideas. + IdeaCategory.create({idea_id: Idea.all.shuffle.first.id, category_id: Category.all.shuffle.first.id}) +end From e404e146af45455800a30f01ac8a9d0876a22a59 Mon Sep 17 00:00:00 2001 From: rtdp Date: Fri, 15 Jun 2012 19:57:01 +0530 Subject: [PATCH 08/14] fixed broken css for catgories --- app/assets/stylesheets/style.css.sass | 4 +++- app/views/ideas/_idea.html.haml | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/assets/stylesheets/style.css.sass b/app/assets/stylesheets/style.css.sass index a659f01..de3f008 100644 --- a/app/assets/stylesheets/style.css.sass +++ b/app/assets/stylesheets/style.css.sass @@ -72,8 +72,10 @@ input.span8, .uneditable-input.span8 .idea-index .grid + .categoriesNames + padding-left: 5px .description - min-height: 150px + min-height: 140px padding: 5px span display: block diff --git a/app/views/ideas/_idea.html.haml b/app/views/ideas/_idea.html.haml index 1b3f2fe..bf6a95f 100644 --- a/app/views/ideas/_idea.html.haml +++ b/app/views/ideas/_idea.html.haml @@ -3,7 +3,8 @@ %h2{class: "title"} = idea.title.truncate(20) %i{class: "#{'favorite' if idea.users.include?(current_user)}"} - %h6= idea.categories.limit(2).collect{|c| content_tag(:l, c.name, :style => 'cursor:pointer') }.join(', ').html_safe or "Category" + %h6.categoriesNames + = idea.categories.empty? ? 'No Categories' : idea.categories.limit(2).collect{|c| content_tag(:l, c.name, :style => 'cursor:pointer') }.join(', ').html_safe .description %span= raw idea.description.truncate(140) = link_to 'Overview', "#idea-detail-#{idea.id}", class: 'details btn btn-info', data: {toggle: 'modal'} From d2c38d0621923e4c8eca3085631bcf344a49c91a Mon Sep 17 00:00:00 2001 From: Shailesh Patil Date: Fri, 15 Jun 2012 20:13:03 +0530 Subject: [PATCH 09/14] changed the twitter handle --- app/views/ideas/_idea.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/ideas/_idea.html.haml b/app/views/ideas/_idea.html.haml index bfc17a9..2b9977a 100644 --- a/app/views/ideas/_idea.html.haml +++ b/app/views/ideas/_idea.html.haml @@ -17,7 +17,7 @@ =# pluralize(idea.users.count, "participant") = idea.users.count %span - = tweet_button :via => "joshideahub",:count=> "none", :url => idea_url(idea), :text => "This is an interesting idea! Help out " + = tweet_button :via => "punerb",:count=> "none", :url => idea_url(idea), :text => "This is an interesting idea! Help out " .modal{style: "display:none", id: "idea-detail-#{idea.id}"} .modal-header From 2ec75ccb9988910230f1707678728c4467d98deb Mon Sep 17 00:00:00 2001 From: rtdp Date: Fri, 15 Jun 2012 22:44:52 +0530 Subject: [PATCH 10/14] fixed categories css in lightbox --- app/views/ideas/_idea.html.haml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/views/ideas/_idea.html.haml b/app/views/ideas/_idea.html.haml index a6fdae5..d39c996 100644 --- a/app/views/ideas/_idea.html.haml +++ b/app/views/ideas/_idea.html.haml @@ -25,12 +25,16 @@ %button{class: "close", data: {:dismiss => "modal"}} x %h3= idea.title .modal-body - %h6= idea.categories.collect(&:name).join(', ') + %h5 + Categories: + %h6 + = idea.categories.collect(&:name).join(', ') %h5 Github URL: = link_to idea.github, idea.github, target: '_blank' %h5.marTop10 Idea By: + %p = idea.user_name %h5.marTop10 Description From c04d6ee152a9691a0be21c81e9de3e25fd97de52 Mon Sep 17 00:00:00 2001 From: anujaware Date: Tue, 19 Jun 2012 19:02:14 +0530 Subject: [PATCH 11/14] Javascript code to filter ideas moved --- app/assets/javascripts/ideas.js.coffee | 6 ++++++ app/views/ideas/index.html.haml | 6 ------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/assets/javascripts/ideas.js.coffee b/app/assets/javascripts/ideas.js.coffee index 6be2fcb..c11a8ba 100644 --- a/app/assets/javascripts/ideas.js.coffee +++ b/app/assets/javascripts/ideas.js.coffee @@ -5,6 +5,12 @@ # You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ $(document).ready -> + #Idea filteration according to category + $("h6 l").click -> + cat = $(this).html() + $(".idea-box").hide() + $("." + cat).show() + # Where there is change in the typeahead text box $('#idea_category_ids').on 'change', (e) -> add_category @ diff --git a/app/views/ideas/index.html.haml b/app/views/ideas/index.html.haml index 392fefd..4df903a 100644 --- a/app/views/ideas/index.html.haml +++ b/app/views/ideas/index.html.haml @@ -1,8 +1,2 @@ .container.idea-index = render @ideas, participate: true -:javascript - $('h6 l').click(function(){ - cat = $(this).html(); - $('.idea-box').hide(); - $('.'+cat).show(); - }); From de6d46671e3655df114df2cde8bf5aa68e3199bd Mon Sep 17 00:00:00 2001 From: Rishi Jain Date: Fri, 22 Jun 2012 19:18:27 +0530 Subject: [PATCH 12/14] removed earlier code --- app/controllers/ideas_controller.rb | 7 +------ app/views/ideas/_link_for_participate.html.haml | 2 -- app/views/ideas/_link_for_un_participate.html.haml | 3 --- app/views/ideas/_participants_count.html.haml | 2 -- app/views/ideas/not_interested.js.haml | 4 ---- config/routes.rb | 1 - 6 files changed, 1 insertion(+), 18 deletions(-) delete mode 100644 app/views/ideas/_link_for_participate.html.haml delete mode 100644 app/views/ideas/_link_for_un_participate.html.haml delete mode 100644 app/views/ideas/_participants_count.html.haml delete mode 100644 app/views/ideas/not_interested.js.haml diff --git a/app/controllers/ideas_controller.rb b/app/controllers/ideas_controller.rb index dbb549e..5b19dc2 100644 --- a/app/controllers/ideas_controller.rb +++ b/app/controllers/ideas_controller.rb @@ -1,6 +1,6 @@ class IdeasController < ApplicationController before_filter :authenticate_user!, :except => [:index, :show] - before_filter :get_idea, :only => [:update, :edit, :show, :participate, :not_interested] + before_filter :get_idea, :only => [:update, :edit, :show, :participate] def index @ideas = Idea.includes(:users).includes(:categories) @@ -48,11 +48,6 @@ def participate end end - def not_interested - idea_user = IdeaUser.where(:user_id => current_user.id, :idea_id => @idea.id).first - idea_user.destroy unless idea_user.nil? - end - private def get_idea @idea = Idea.find_by_id(params[:id]) diff --git a/app/views/ideas/_link_for_participate.html.haml b/app/views/ideas/_link_for_participate.html.haml deleted file mode 100644 index ea33531..0000000 --- a/app/views/ideas/_link_for_participate.html.haml +++ /dev/null @@ -1,2 +0,0 @@ -%div{:id => "add_not_interested_link_#{@idea.id}"} - = link_to 'Participate', participate_idea_path(@idea), :class => 'participate btn btn-info', :id => "participate_#{@idea.id}", :remote => true diff --git a/app/views/ideas/_link_for_un_participate.html.haml b/app/views/ideas/_link_for_un_participate.html.haml deleted file mode 100644 index ee3d8a2..0000000 --- a/app/views/ideas/_link_for_un_participate.html.haml +++ /dev/null @@ -1,3 +0,0 @@ -%div{:id => "add_participate_link_#{@idea.id}"} - = link_to 'Not Interested', not_interested_idea_path(@idea), :class => 'participate btn btn-info', :id => "not_interested_#{@idea.id}", :remote => true - diff --git a/app/views/ideas/_participants_count.html.haml b/app/views/ideas/_participants_count.html.haml deleted file mode 100644 index 79c210e..0000000 --- a/app/views/ideas/_participants_count.html.haml +++ /dev/null @@ -1,2 +0,0 @@ -%span{:id => "participants_count_#{@idea.id}"} - = pluralize(@idea.users.count, "participant") diff --git a/app/views/ideas/not_interested.js.haml b/app/views/ideas/not_interested.js.haml deleted file mode 100644 index f36817d..0000000 --- a/app/views/ideas/not_interested.js.haml +++ /dev/null @@ -1,4 +0,0 @@ -$('#idea-#{@idea.id} a h2 i').removeClass('favorite') -$('#add_participate_link_#{@idea.id}').html("#{escape_javascript(render :partial => 'ideas/link_for_participate')}") -$('#participants_count_#{@idea.id}').html("#{escape_javascript(render :partial => 'ideas/participants_count')}") - diff --git a/config/routes.rb b/config/routes.rb index 0d90326..07cfbdb 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -18,7 +18,6 @@ resources :ideas do get 'participate', :on => :member - get 'not_interested', :on => :member resources :schedules end From 52dd0d13e3f7d8b59b6922d342ecf0127b78d471 Mon Sep 17 00:00:00 2001 From: Rishi Jain Date: Fri, 22 Jun 2012 20:04:39 +0530 Subject: [PATCH 13/14] fixed the count of users --- app/views/ideas/_idea.html.haml | 2 +- app/views/ideas/participate.js.haml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/ideas/_idea.html.haml b/app/views/ideas/_idea.html.haml index d39c996..0d3b9cb 100644 --- a/app/views/ideas/_idea.html.haml +++ b/app/views/ideas/_idea.html.haml @@ -16,7 +16,7 @@ .floatLeft %i.icon-user> =# pluralize(idea.users.count, "participant") - = idea.users.count + %span{:id => "idea_count_#{idea.id}"} #{idea.users.count} .floatRight = tweet_button :via => "punerb",:count=> "none", :url => idea_url(idea), :text => "This is an interesting idea! Help out " diff --git a/app/views/ideas/participate.js.haml b/app/views/ideas/participate.js.haml index 2dba9d2..4a9a33a 100644 --- a/app/views/ideas/participate.js.haml +++ b/app/views/ideas/participate.js.haml @@ -1,4 +1,4 @@ -$('#idea-#{@idea.id} .detail span:last').html(" #{pluralize(@idea.users.count, 'participant')}") +$('#idea_count_#{@idea.id}').text("#{@idea.users.count}") - if @participant $('#idea-#{@idea.id} a.participate.btn').text('Participate') $('#idea-#{@idea.id} a h2 i').removeClass('favorite') From c4728ed062e9ec6424170994b1c5c1abb249b794 Mon Sep 17 00:00:00 2001 From: Rishi Jain Date: Fri, 29 Jun 2012 18:53:31 +0530 Subject: [PATCH 14/14] if user is not logged in, user is redirected to twitter authentication --- app/helpers/ideas_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers/ideas_helper.rb b/app/helpers/ideas_helper.rb index dc6dac1..ef2be19 100644 --- a/app/helpers/ideas_helper.rb +++ b/app/helpers/ideas_helper.rb @@ -13,7 +13,7 @@ def participate_button(idea) participant = idea.users.include?(current_user) ? 'Leave' : 'Participate' link_to participant, participate_idea_path(idea), :class => 'participate btn btn-info', :remote => true else - link_to 'Participate', participate_idea_path(idea), :class => 'participate btn btn-info', onclick: "alert('You need to login with twitter to participate.'); return false;" + link_to 'Participate', participate_idea_path(idea), :class => 'participate btn btn-info', onclick: "alert('You need to login to participate,you will be redirected to twitter authentication');window.location='/auth/twitter'; return false;" end end