Changed Ruby syntax in views. Fixed #1326

This commit is contained in:
divyanshumehta 2017-03-11 13:25:39 +05:30
parent b0a84ad1c6
commit 1ca448df6f
74 changed files with 371 additions and 376 deletions

View file

@ -8,15 +8,15 @@
since #{campaigns.values[0]['created_at']}.
%p
That is
%strong{'style'=>"color: #{target_progress_color(campaigns.values[0]['progress'])};"}
%strong{ 'style' => "color: #{target_progress_color(campaigns.values[0]['progress'])};" }
#{campaigns.values[0]['progress']} %
of your target, there are
%strong{'style'=>"color: #{days_left_color(campaigns.values[0]['days_left'])};"}
%strong{ 'style' => "color: #{days_left_color(campaigns.values[0]['days_left'])};" }
#{pluralize(campaigns.values[0]['days_left'], 'day')} left.
.row
.col-md-12
%div{'style'=>'display: none;', 'id'=>"#{name}"}
- campaigns.drop(1).each do |(key, value)|
%div{ 'style' => 'display: none;', 'id' => "#{name}" }
- campaigns.drop(1).each do |(_key, value)|
%div
%p
Your target "#{value['target_name']}" from campaign "#{value['campaign_name']}" has generated
@ -25,16 +25,16 @@
since #{value['created_at']}.
%p
That is
%strong{'style'=>"color: #{target_progress_color(value['progress'])};"}
%strong{ 'style' => "color: #{target_progress_color(value['progress'])};" }
#{value['progress']} %
of your target, there are
%strong{'style'=>"color: #{days_left_color(value['days_left'])};"}
%strong{ 'style' => "color: #{days_left_color(value['days_left'])};" }
#{pluralize(value['days_left'], 'day')} left.
.row
.col-md-12
- if campaigns.length > 1
%a.show_targets{'href'=>'#', 'data-name'=>"#{name}"}
%a.show_targets{ 'href' => '#', 'data-name' => "#{name}" }
more
- else
%h5.text-warning.text-center
No Campaigns!
No Campaigns!

View file

@ -1,6 +1,6 @@
.text-center
%h4 #{title}
%canvas.doughnut_chart{"data-chart"=>data.to_json}
%canvas.doughnut_chart{ 'data-chart' => data.to_json }
- if data
- data.each do |key, value|
%span{"style"=>"border-bottom: 3px solid #{value['color']}"} #{key}: #{value['value']}
%span{ 'style' => "border-bottom: 3px solid #{value['color']}" } #{key}: #{value['value']}

View file

@ -5,25 +5,25 @@
= title
.row
.col-md-12
.chart_data{ "data-chart"=>"#{y.to_json}", "data-conferences"=>"#{conferences.to_json}",
"data-deactive"=>"#{deactive_conferences.to_json}", "data-weeks"=>"#{x.to_json}",
"data-active"=>"#{active_conferences.to_json}"}
%canvas.line_chart{ :id => "line_chart_#{name}", "data-name"=>"#{name}" }
.chart_data{ 'data-chart' => "#{y.to_json}", 'data-conferences' => "#{conferences.to_json}",
'data-deactive' => "#{deactive_conferences.to_json}", 'data-weeks' => "#{x.to_json}",
'data-active' => "#{active_conferences.to_json}" }
%canvas.line_chart{ id: "line_chart_#{name}", 'data-name' => "#{name}" }
.row
.col-md-12
.text-center
= unit
.row
.col-md-12
.conferenceCheckboxes{ :id => "#{name}Checkboxes", "data-name"=>"#{name}" }
.conferenceCheckboxes{ id: "#{name}Checkboxes", 'data-name' => "#{name}" }
- if active_conferences && deactive_conferences && conferences && conferences.length > 1
- active_conferences.each do |conference|
%div
%span{ "style"=>"border-bottom: 3px solid #{conference[:color]};", "data-chart"=> "#{name}" }
%input{ "type"=>"checkbox", "name"=>"#{conference[:short_title]}", "checked"=>"checked"}
%span{ 'style' => "border-bottom: 3px solid #{conference[:color]};", 'data-chart' => "#{name}" }
%input{ 'type' => 'checkbox', 'name' => "#{conference[:short_title]}", 'checked' => 'checked' }
#{conference[:short_title]}
- deactive_conferences.each do |conference|
%div
%span{"style"=>"border-bottom: 3px solid #{conference[:color]};", "data-chart"=> "#{name}" }
%input{"type"=>"checkbox", "name"=>"#{conference[:short_title]}" }
%span{ 'style' => "border-bottom: 3px solid #{conference[:color]};", 'data-chart' => "#{name}" }
%input{ 'type' => 'checkbox', 'name' => "#{conference[:short_title]}" }
#{conference[:short_title]}

View file

@ -19,7 +19,7 @@
%td= link_to event.title, admin_conference_program_event_path(event.program.conference.short_title, event)
%td= link_to event.program.conference.title, admin_conference_path(event.program.conference.short_title)
%td
.span{'class'=>label_for(event.state)} #{event.state.humanize}
.span{ 'class' => label_for(event.state) } #{event.state.humanize}
- else
%h5.text-warning.text-center
No submissions!

View file

@ -14,12 +14,12 @@
%td= link_to user.email, admin_user_path(user.id)
%td= user.created_at.strftime('%m/%d/%Y')
%td
= check_box_tag user.id, user.id, user.confirmed?,
method: :patch,
url: "/admin/users/#{user.id}/toggle_confirmation?user[to_confirm]=",
class: 'switch-checkbox',
= check_box_tag user.id, user.id, user.confirmed?,
method: :patch,
url: "/admin/users/#{user.id}/toggle_confirmation?user[to_confirm]=",
class: 'switch-checkbox',
readonly: true,
data: { size: 'small', on_color: 'success', off_color: 'warning', on_text: 'Yes', off_text: 'No' }
data: { size: 'small', on_color: 'success', off_color: 'warning', on_text: 'Yes', off_text: 'No' }
- else
%h5.text-warning.text-center
No sign ups!

View file

@ -7,13 +7,13 @@
Target 1
.row
.col-md-10
.progress{'title'=>"#{targets.keys[0]}"}
.progress-bar{ 'role'=>'progressbar', 'aria-valuenow'=>"#{targets.values[0]}", 'aria-valuemin'=>'0',
'aria-valuemax'=>'100', 'style'=>"width: #{targets.values[0]}%;"}
.progress{ 'title' => "#{targets.keys[0]}" }
.progress-bar{ 'role' => 'progressbar', 'aria-valuenow' => " #{targets.values[0]}", 'aria-valuemin' => '0',
'aria-valuemax' => '100', 'style' => "width: #{targets.values[0]}%;" }
= "#{targets.values[0]} %"
.row
.col-md-8.col-md-offset-2
%div{'style'=>'display: none;', 'id'=>"#{name}"}
%div{ 'style' => 'display: none;', 'id' => "#{name}" }
- targets.drop(1).each_with_index do |(key, value), index|
.row
.col-md-10
@ -21,12 +21,12 @@
= "Target #{index + 2}"
.row
.col-md-10
.progress{'title'=>"#{key}"}
.progress-bar{ 'role'=>'progressbar', 'aria-valuenow'=>"#{value}", 'aria-valuemin'=>'0',
'aria-valuemax'=>'100', 'style'=>"width: #{value}%;" }
.progress{ 'title' => "#{key}" }
.progress-bar{ 'role' => 'progressbar', 'aria-valuenow' => "#{value}", 'aria-valuemin' => '0',
'aria-valuemax' => '100', 'style' => "width: #{value}%;" }
= "#{value} %"
.row
.col-md-2.col-md-offset-2
- if targets.length > 1
%a.show_targets{'href'=>'#', 'data-name'=>"#{name}"}
%a.show_targets{ 'href' => '#', 'data-name' => "#{name}" }
more

View file

@ -3,11 +3,11 @@
%h4
Conference progress
.progress
.progress-bar{ 'role'=>'progressbar', 'aria-valuenow'=>"#{conference_progress['process']}", 'aria-valuemin'=>'0',
'aria-valuemax'=>'100', 'style'=>"width: #{conference_progress['process']}%;" }
.progress-bar{ 'role' => 'progressbar', 'aria-valuenow' => "#{conference_progress['process']}", 'aria-valuemin' => '0',
'aria-valuemax' => '100', 'style' => "width: #{conference_progress['process']}%;" }
= conference_progress['process'] + '%'
%li{'class'=>"list-group-item #{class_for_todo(conference_progress['registration'])}"}
%span{'class'=>icon_for_todo(conference_progress['registration'])}
%li{ 'class' => "list-group-item #{class_for_todo(conference_progress['registration'])}" }
%span{ 'class' => icon_for_todo(conference_progress['registration']) }
- if can? :update, @conference
- if conference.registration_period
= link_to 'Set up registration period', edit_admin_conference_registration_period_path(conference_progress['short_title'])
@ -15,14 +15,14 @@
= link_to 'Set up registration period', new_admin_conference_registration_period_path(conference_progress['short_title'])
- else
Set up registration period
%li{'class'=>"list-group-item #{class_for_todo(conference_progress['cfp'])}"}
%span{'class'=>icon_for_todo(conference_progress['cfp'])}
%li{ 'class' => "list-group-item #{class_for_todo(conference_progress['cfp'])}" }
%span{ 'class' => icon_for_todo(conference_progress['cfp']) }
- if can? :update, Cfp.new(program_id: @program.id)
= link_to 'Set up call for papers', admin_conference_program_cfp_path(conference_progress['short_title'])
- else
Set up call for papers
%li{'class'=>"list-group-item #{class_for_todo(conference_progress['venue'])}"}
%span{'class'=>icon_for_todo(conference_progress['venue'])}
%li{ 'class' => "list-group-item #{class_for_todo(conference_progress['venue'])}" }
%span{ 'class' => icon_for_todo(conference_progress['venue']) }
- if can? :update, @conference.venue
- if conference.venue
= link_to 'Add venue', edit_admin_conference_venue_path(conference_progress['short_title'])
@ -30,32 +30,32 @@
= link_to 'Add venue', new_admin_conference_venue_path(conference_progress['short_title'])
- else
Add venue
%li{'class'=>"list-group-item #{class_for_todo(conference_progress['rooms'])}"}
%span{'class'=>icon_for_todo(conference_progress['rooms'])}
%li{ 'class' => "list-group-item #{class_for_todo(conference_progress['rooms'])}" }
%span{ 'class' => icon_for_todo(conference_progress['rooms']) }
- if @conference.venue && (can? :update, @conference.venue.rooms.build)
= link_to 'Add rooms', admin_conference_venue_rooms_path(conference_progress['short_title'])
- else
Add rooms
%li{'class'=>"list-group-item #{class_for_todo(conference_progress['tracks'])}"}
%span{'class'=>icon_for_todo(conference_progress['tracks'])}
%li{ 'class' => "list-group-item #{class_for_todo(conference_progress['tracks'])}" }
%span{ 'class' => icon_for_todo(conference_progress['tracks']) }
- if can? :update, @conference.program.tracks.build
= link_to 'Add tracks', admin_conference_program_tracks_path(conference_progress['short_title'])
- else
Add tracks
%li{'class'=>"list-group-item #{class_for_todo(conference_progress['event_types'])}"}
%span{'class'=>icon_for_todo(conference_progress['event_types'])}
%li{ 'class' => "list-group-item #{class_for_todo(conference_progress['event_types'])}" }
%span{ 'class' => icon_for_todo(conference_progress['event_types']) }
- if can? :update, @conference.program.event_types.build
= link_to 'Add event types', admin_conference_program_event_types_path(conference_progress['short_title'])
- else
Add event types
%li{'class'=>"list-group-item #{class_for_todo(conference_progress['difficulty_levels'])}"}
%span{'class'=>icon_for_todo(conference_progress['difficulty_levels'])}
%li{ 'class' => "list-group-item #{class_for_todo(conference_progress['difficulty_levels'])}" }
%span{ 'class' => icon_for_todo(conference_progress['difficulty_levels']) }
- if can? :update, @conference.program.difficulty_levels.build
= link_to 'Add difficulty levels', admin_conference_program_difficulty_levels_path(conference_progress['short_title'])
- else
Add difficulty levels
%li{class: "list-group-item #{class_for_todo(conference_progress['splashpage'])}"}
%span{'class'=>icon_for_todo(conference_progress['splashpage'])}
%li{ class: "list-group-item #{class_for_todo(conference_progress['splashpage'])}" }
%span{ 'class' => icon_for_todo(conference_progress['splashpage']) }
- if can? :update, @conference
= link_to 'Set up a Splashpage', admin_conference_splashpage_path(conference_progress['short_title'])
- else

View file

@ -6,7 +6,7 @@
- @top_submitter.each do |key, value|
.row.top-submitter
.col-md-2
= image_tag(key.gravatar_url(size: '25'), title: "Yo #{key.name}!", :alt => '', 'class'=>'img-circle img-responsive text-center')
= image_tag(key.gravatar_url(size: '25'), title: "Yo #{key.name}!", alt: '', 'class' => 'img-circle img-responsive text-center')
.col-md-10
%h4
= link_to key.name, admin_user_path(key)

View file

@ -6,23 +6,23 @@
The most basic settings of your conference
.row
.col-md-8
= semantic_form_for(@conference, :url => admin_conference_path(@conference.short_title),:html => {:multipart => true}) do |f|
= f.input :title, :hint => "The full title of the conference, e.g. 'openSUSE Conference 2014'"
= f.input :short_title, :hint => "A short title, e.g. 'oSC14', to be used in URLs"
= semantic_form_for(@conference, url: admin_conference_path(@conference.short_title), html: {multipart: true}) do |f|
= f.input :title, hint: "The full title of the conference, e.g. 'openSUSE Conference 2014'"
= f.input :short_title, hint: "A short title, e.g. 'oSC14', to be used in URLs"
= f.input :description, hint: markdown_hint('A description of the conference.'), input_html: { rows: 5, data: { provide: 'markdown-editable' } }
= f.input :color, :hint => "The color will be used eg for the dashboard.", :input_html => {:size => 6, :type => "color"}
= f.input :color, hint: 'The color will be used eg for the dashboard.', input_html: {size: 6, type: 'color'}
= f.label 'Conference Logo'
%br
- if @conference.picture?
= image_tag @conference.picture.thumb.url
= f.input :picture, :label => false, :hint => "This will be displayed on the front page."
= f.input :picture, label: false, hint: 'This will be displayed on the front page.'
= f.hidden_field :picture_cache
= f.inputs :name => "Scheduling" do
= f.input :timezone, :as => :time_zone, :hint => "The conference time zone"
= f.input :start_date, :as => :string, :input_html => { :id => "conference-start-datepicker", :readonly => "readonly" }
= f.input :end_date, :as => :string, :input_html => { :id => "conference-end-datepicker", :readonly => "readonly" }
= f.input :start_hour, :input_html => {size: 2, type: 'number', min: 0, max: 23}
= f.input :end_hour, :input_html => {size: 2, type: 'number', min: 1, max: 24}
= f.inputs name: "Registrations" do
= f.input :registration_limit, as: :number, in: 0..9999, hint: "Limit the number of registrations to the conference (0 no limit). You currently have " + pluralize(@conference.registrations.count,'registration')
= f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"}
= f.inputs name: 'Scheduling' do
= f.input :timezone, as: :time_zone, hint: 'The conference time zone'
= f.input :start_date, as: :string, input_html: { id: 'conference-start-datepicker', readonly: 'readonly' }
= f.input :end_date, as: :string, input_html: { id: 'conference-end-datepicker', readonly: 'readonly' }
= f.input :start_hour, input_html: {size: 2, type: 'number', min: 0, max: 23}
= f.input :end_hour, input_html: {size: 2, type: 'number', min: 1, max: 24}
= f.inputs name: 'Registrations' do
= f.input :registration_limit, as: :number, in: 0..9999, hint: 'Limit the number of registrations to the conference (0 no limit). You currently have ' + pluralize(@conference.registrations.count, 'registration')
= f.action :submit, as: :button, button_html: {class: 'btn btn-primary'}

View file

@ -8,7 +8,7 @@
%small
#{'User'.pluralize(@total_user)}
- if @new_user
%span.label.label-success{title: "+ #{@new_user} since you last logged in!"}
%span.label.label-success{ title: "+ #{@new_user} since you last logged in!" }
+
= @new_user
.col-sm-4.col-xs-4
@ -20,7 +20,7 @@
%small
#{'Registration'.pluralize(@total_reg)}
- if @new_reg
%span.label.label-success{title: "+#{@new_reg} since you last logged in!"}
%span.label.label-success{ title: "+#{@new_reg} since you last logged in!" }
+
= @new_reg
.col-sm-4.col-xs-4
@ -32,7 +32,7 @@
%small
#{'Submission'.pluralize(@total_submissions)}
- if @new_submissions
%span.label.label-success{title: "+#{@new_submissions} since you last logged in!"}
%span.label.label-success{ title: "+#{@new_submissions} since you last logged in!" }
+
= @new_submissions
@ -47,7 +47,7 @@
x: @registration_weeks,
unit: 'weeks' }
.col-md-4
= render partial: 'doughnut_chart', locals: { title: 'Events',data: @event_distribution }
= render partial: 'doughnut_chart', locals: { title: 'Events', data: @event_distribution }
.row#submissions
.col-md-8
= render partial: 'line_chart', locals: { title: 'Submissions over time',
@ -59,20 +59,20 @@
x: @cfp_weeks,
unit: 'weeks' }
.col-md-4
= render partial: 'doughnut_chart', locals: { title: 'User',data: @user_distribution }
= render partial: 'doughnut_chart', locals: { title: 'User', data: @user_distribution }
.row
.col-md-8
%ul.nav.nav-tabs#recentTable
%li.active
%a{:href=>"#recent_user", "data-toggle"=>"tab"}
%a{ href: '#recent_user', 'data-toggle' => 'tab' }
%span.fa.fa-user
Recent Users
%li
%a{:href=>"#recent_reg", "data-toggle"=>"tab"}
%a{ href: '#recent_reg', 'data-toggle' => 'tab' }
%span.fa.fa-check-square
Recent Registrations
%li
%a{:href=>"#recent_submissions", "data-toggle"=>"tab"}
%a{ href: '#recent_submissions', 'data-toggle' => 'tab' }
%span.fa.fa-file-text
Recent Submissions
.tab-content

View file

@ -1,11 +1,11 @@
.row
.col-md-8
= semantic_form_for(@conference, :url => admin_conferences_path) do |f|
= semantic_form_for(@conference, url: admin_conferences_path) do |f|
= f.inputs 'Basic Information' do
= f.input :title, hint: "The name of your conference as it shall appear throughout the site. Example: 'OpenSUSE Conference 2013'",
input_html: { required: 'required' }
= f.input :short_title, hint: "A short and unique handle for your conference, using only letters, numbers, underscores, and dashes. This will be used to identify your conference in URLs etc. Example: 'froscon2011'",
input_html: { required: 'required', pattern: '[a-zA-Z0-9_-]+', title: 'Only letters, numbers, underscores, and dashes.' }, :prepend => conferences_url + '/'
input_html: { required: 'required', pattern: '[a-zA-Z0-9_-]+', title: 'Only letters, numbers, underscores, and dashes.' }, prepend: conferences_url + '/'
= f.inputs 'Scheduling' do
= f.input :timezone, as: :time_zone, default: Time.zone.name, hint: 'Please select in what time zone your conference will take place.'
= f.input :start_date, as: :string, input_html: { id: 'conference-start-datepicker', required: 'required' }

View file

@ -12,7 +12,7 @@
%small
#{'Registration'.pluralize(@total_reg)}
- if @new_reg
%span.label.label-success{title: "+#{@new_reg} since you last logged in!"}
%span.label.label-success{ title: "+#{@new_reg} since you last logged in!" }
+
= @new_reg
@ -25,7 +25,7 @@
%small
#{'Submission'.pluralize(@total_submissions)}
- if @new_submissions
%span.label.label-success{title: "+#{@new_submissions} since you last logged in!"}
%span.label.label-success{ title: "+#{@new_submissions} since you last logged in!" }
+
= @new_submissions
@ -38,7 +38,7 @@
%small
#{'Hour'.pluralize(@program_length)}
- if @new_reg
%span.label.label-success{title: "+#{@new_program_length} since you last logged in!"}
%span.label.label-success{ title: "+#{@new_program_length} since you last logged in!" }
+
= @new_program_length
@ -73,11 +73,11 @@
.col-md-12#doughnut
%ul.nav.nav-tabs#doughnut_tabs
%li.active
%a{:href=>"#distribution_all", "data-toggle"=>"tab"}
%a{ href: '#distribution_all', 'data-toggle' => 'tab' }
%span.fa.fa-star
All
%li
%a{:href=>"#distribution_confirmed", "data-toggle"=>"tab"}
%a{ href: '#distribution_confirmed', 'data-toggle' => 'tab' }
%span.fa.fa-comment
Confirmed
.tab-content
@ -102,11 +102,11 @@
.col-md-8
%ul.nav.nav-tabs#recentTable
%li.active
%a{:href=>"#recent_reg", "data-toggle"=>"tab"}
%a{ href: '#recent_reg', 'data-toggle' => 'tab' }
%span.fa.fa-user
Recent Registrations
%li
%a{:href=>"#recent_submissions", "data-toggle"=>"tab"}
%a{ href: '#recent_submissions', 'data-toggle' => 'tab' }
%span.fa.fa-file-text
Recent Submissions
.tab-content