Skip to content

Commit

Permalink
Rubocop AA.
Browse files Browse the repository at this point in the history
  • Loading branch information
Hari Gopal committed Sep 17, 2015
1 parent 5ad4b5b commit be4201b
Show file tree
Hide file tree
Showing 12 changed files with 116 additions and 180 deletions.
3 changes: 1 addition & 2 deletions app/admin/admin_user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
filter :email

form do |f|
f.inputs "Admin Details" do
f.inputs 'Admin Details' do
f.input :email
f.input :password
f.input :password_confirmation
Expand All @@ -24,5 +24,4 @@
end
f.actions
end

end
10 changes: 7 additions & 3 deletions app/admin/karma_point.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
permit_params :user_id, :points, :activity_type, :created_at

preserve_default_filters!
filter :user_startup_id_eq, label: 'Startup from Batch 1', as: :select, collection: Proc.new { Startup.where(batch: 1) }
filter :user_startup_id_eq, label: 'Startup from Batch 1', as: :select, collection: proc { Startup.where(batch: 1) }

controller do
def scoped_collection
Expand Down Expand Up @@ -36,9 +36,13 @@ def scoped_collection

form do |f|
f.inputs 'Extra' do
f.input :user, collection: User.founders,
member_label: Proc.new { |u| "#{u.fullname} - #{u.title.present? ? (u.title + ', ') : ''}#{u.startup.name}" },
f.input(
:user,
collection: User.founders,
member_label: proc { |u| "#{u.fullname} - #{u.title.present? ? (u.title + ', ') : ''}#{u.startup.name}" },
input_html: { style: 'width: calc(80% - 22px);' }
)

f.input :points
f.input :activity_type
f.input :created_at, as: :datepicker
Expand Down
95 changes: 0 additions & 95 deletions app/admin/mentor.rb

This file was deleted.

13 changes: 0 additions & 13 deletions app/admin/mentor_meeting.rb

This file was deleted.

15 changes: 0 additions & 15 deletions app/admin/mentor_skill.rb

This file was deleted.

55 changes: 38 additions & 17 deletions app/admin/startup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,8 @@ def find_resource
end

actions do |startup|
link_to "View Timeline", startup, target: "_blank"
link_to 'View Timeline', startup, target: '_blank'
end

end

csv do
Expand Down Expand Up @@ -82,11 +81,22 @@ def find_resource
end

action_item :view_feedback, only: :show do
link_to('View All Feedback', admin_startup_feedback_index_url("q[startup_id_eq]" => Startup.friendly.find(params[:id]).id,"commit" => "Filter"))
link_to(
'View All Feedback',
admin_startup_feedback_index_url('q[startup_id_eq]' => Startup.friendly.find(params[:id]).id, commit: 'Filter')
)
end

action_item :record_feedback, only: :show do
link_to('Record New Feedback', new_admin_startup_feedback_path(startup_feedback: { startup_id: Startup.friendly.find(params[:id]).id, reference_url: startup_url(Startup.friendly.find(params[:id])) }))
link_to(
'Record New Feedback',
new_admin_startup_feedback_path(
startup_feedback: {
startup_id: Startup.friendly.find(params[:id]).id,
reference_url: startup_url(Startup.friendly.find(params[:id]))
}
)
)
end

action_item :view_timeline, only: :show do
Expand Down Expand Up @@ -124,10 +134,11 @@ def find_resource
member_action :get_all_startup_feedback do
startup = Startup.friendly.find params[:id]
feedback = startup.startup_feedback.order('updated_at desc')

respond_to do |format|
format.json {
render json: {:feedback => feedback, :startup_name => startup.name}
}
format.json do
render json: { feedback: feedback, startup_name: startup.name }
end
end
end

Expand All @@ -145,23 +156,29 @@ def find_resource
div class: 'startup-status-buttons' do
unless startup.approved? || startup.unready?
span do
button_to('Approve Startup',
button_to(
'Approve Startup',
custom_update_admin_startup_path(startup: { approval_status: Startup::APPROVAL_STATUS_APPROVED }, email_to_send: :approval),
method: :put, data: { confirm: 'Are you sure you want to approve this startup?' })
method: :put, data: { confirm: 'Are you sure you want to approve this startup?' }
)
end
end
unless startup.rejected? || startup.unready?
span do
button_to('Reject Startup',
button_to(
'Reject Startup',
custom_update_admin_startup_path(startup: { approval_status: Startup::APPROVAL_STATUS_REJECTED }, email_to_send: :rejection),
{ method: :put, data: { confirm: 'Are you sure you want to reject this startup?' } })
method: :put, data: { confirm: 'Are you sure you want to reject this startup?' }
)
end
end
unless startup.dropped_out?
span do
button_to('Drop-out Startup',
button_to(
'Drop-out Startup',
custom_update_admin_startup_path(startup: { approval_status: Startup::APPROVAL_STATUS_DROPPED_OUT }, email_to_send: :dropped_out),
{ method: :put, data: { confirm: 'Are you sure you want to drop out this startup?' } })
method: :put, data: { confirm: 'Are you sure you want to drop out this startup?' }
)
end
end
if startup.unready?
Expand Down Expand Up @@ -241,16 +258,20 @@ def find_resource
end

panel 'Emails and Notifications' do
link_to('Reminder to complete startup profile', send_startup_profile_reminder_admin_startup_path, method: :post, data: { confirm: 'Are you sure you wish to send notification and email?' })
link_to(
'Reminder to complete startup profile',
send_startup_profile_reminder_admin_startup_path,
method: :post, data: { confirm: 'Are you sure you wish to send notification and email?' }
)
end
end

form :partial => 'admin/startups/form'
form partial: 'admin/startups/form'

permit_params :name, :website, :about, :email, :logo, :facebook_link, :twitter_link,
{ category_ids: [] }, { founder_ids: [] }, { founders_attributes: [:id, :fullname, :email, :avatar, :remote_avatar_url, :title, :linkedin_url, :twitter_url, :skip_password] },
{ category_ids: [] }, { founder_ids: [] },
{ founders_attributes: [:id, :fullname, :email, :avatar, :remote_avatar_url, :title, :linkedin_url, :twitter_url, :skip_password] },
:created_at, :updated_at, :approval_status, :approval_status, :registration_type,
:incubation_location, :agreement_sent, :agreement_first_signed_at, :agreement_last_signed_at, :agreement_duration,
:physical_incubatee, :presentation_link, :slug, :featured, :batch
end

23 changes: 17 additions & 6 deletions app/admin/startup_feedback.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def scoped_collection
end
end

index :title => 'Startup Feedback' do
index title: 'Startup Feedback' do
selectable_column
column :startup

Expand All @@ -28,7 +28,11 @@ def scoped_collection
if startup_feedback.send_at.present?
startup_feedback.send_at
else
link_to('Email Now!', email_feedback_admin_startup_feedback_path(startup_feedback), method: :put, data: { confirm: 'Are you sure you want to email this feedback to the founders?' })
link_to(
'Email Now!',
email_feedback_admin_startup_feedback_path(startup_feedback),
method: :put, data: { confirm: 'Are you sure you want to email this feedback to the founders?' }
)
end
end

Expand All @@ -48,7 +52,11 @@ def scoped_collection
if startup_feedback.send_at.present?
startup_feedback.send_at
else
link_to('Email Now!', email_feedback_admin_startup_feedback_path(startup_feedback), method: :put, data: { confirm: 'Are you sure you want to email this feedback to the founders?' })
link_to(
'Email Now!',
email_feedback_admin_startup_feedback_path(startup_feedback),
method: :put, data: { confirm: 'Are you sure you want to email this feedback to the founders?' }
)
end
end
end
Expand All @@ -64,8 +72,11 @@ def scoped_collection
redirect_to action: :index
end

action_item :email, only: :show do
link_to 'Email Now!', email_feedback_admin_startup_feedback_path(startup_feedback), method: :put, data: { confirm: 'Are you sure you want to email this feedback to the founders?' } unless startup_feedback.send_at.present?
action_item only: :show, if: proc { startup_feedback.send_at.blank? } do
link_to(
'Email Now!',
email_feedback_admin_startup_feedback_path(startup_feedback),
method: :put, data: { confirm: 'Are you sure you want to email this feedback to the founders?' }
)
end

end
18 changes: 0 additions & 18 deletions app/admin/startup_job.rb

This file was deleted.

Loading

0 comments on commit be4201b

Please sign in to comment.