Skip to content

Commit eab10ed

Browse files
authored
Merge pull request #849 from amatsuda/inline_options_helpers
Inline some helpers in decorators
2 parents 2317f3f + bb45f9d commit eab10ed

File tree

7 files changed

+10
-71
lines changed

7 files changed

+10
-71
lines changed

app/decorators/proposal_decorator.rb

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -89,48 +89,6 @@ def bio
8989
speaker ? speaker.bio : ''
9090
end
9191

92-
def pitch_markdown
93-
h.markdown(object.pitch)
94-
end
95-
96-
def details_markdown
97-
h.markdown(object.details)
98-
end
99-
100-
def abstract_markdown
101-
h.markdown(object.abstract)
102-
end
103-
104-
def withdraw_button
105-
h.link_to h.bang('Withdraw Proposal'),
106-
h.withdraw_event_proposal_path(uuid: object, event_slug: object.event.slug),
107-
data: {
108-
turbo: true,
109-
turbo_method: :post,
110-
turbo_confirm: 'This will remove your talk from consideration and send an email to the event coordinator. Are you sure you want to do this?'
111-
},
112-
class: 'btn btn-warning',
113-
id: 'withdraw'
114-
end
115-
116-
def confirm_button
117-
h.link_to 'Confirm',
118-
h.confirm_event_proposal_path(uuid: object, event_slug: object.event.slug),
119-
data: {turbo: true, turbo_method: :post},
120-
class: 'btn btn-success'
121-
end
122-
123-
def decline_button
124-
h.link_to h.bang('Decline'),
125-
h.decline_event_proposal_path(uuid: object, event_slug: object.event.slug),
126-
data: {
127-
turbo: true,
128-
turbo_method: :post,
129-
turbo_confirm: 'This will remove your talk from consideration and notify the event staff. Are you sure you want to do this?'
130-
},
131-
class: 'btn btn-warning'
132-
end
133-
13492
def confirm_link
13593
h.link_to 'confirmation page',
13694
h.event_proposal_url(object.event, object, protocol: 'https')
@@ -155,25 +113,6 @@ def created_in_words
155113
"#{h.time_ago_in_words(object.created_at)} ago"
156114
end
157115

158-
def title_input(form)
159-
form.input :title,
160-
autofocus: true,
161-
maxlength: :lookup, input_html: { class: 'watched js-maxlength-alert' },
162-
hint: "Publicly viewable title. Ideally catchy, interesting, essence of the talk. Limited to 60 characters."
163-
end
164-
165-
def speaker_input(form)
166-
form.input :speaker
167-
end
168-
169-
def track_options
170-
@track_options ||= object.event.tracks.map { |t| [t.name, t.id] }.sort
171-
end
172-
173-
def format_options
174-
@format_options ||= object.event.session_formats.map { |sf| [sf.name, sf.id] }.sort
175-
end
176-
177116
def invitations_enabled?(user)
178117
object.has_speaker?(user) && !object.finalized?
179118
end

app/views/proposals/_contents.html.haml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
.proposal-section
22
%h3.control-label Abstract
33
.markdown{ data: { 'field-name' => 'proposal[abstract]' } }
4-
= proposal.abstract_markdown
4+
= markdown proposal.abstract
55

66
%h2.fieldset-legend For Review Committee
77

88
.proposal-section
99
%h3.control-label Details
1010
.markdown{ data: { 'field-name' => 'proposal[details]' } }
11-
= proposal.details_markdown
11+
= markdown proposal.details
1212

1313
.proposal-section
1414
%h3.control-label Pitch
1515
.markdown{ data: { 'field-name' => 'proposal[pitch]' } }
16-
=proposal.pitch_markdown
16+
= markdown proposal.pitch
1717

1818
- if proposal.custom_fields.any?
1919
- proposal.proposal_data[:custom_fields].select do |key,value|

app/views/proposals/_form.html.haml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
%fieldset.margin-top
2-
= proposal.title_input(f)
2+
= f.input :title, autofocus: true, maxlength: :lookup, input_html: {class: 'watched js-maxlength-alert'}, hint: 'Publicly viewable title. Ideally catchy, interesting, essence of the talk. Limited to 60 characters.'
33

44
- opts_session_formats = event.session_formats.publicly_viewable.map {|st| [st.name, st.id]}
55
- if !proposal.has_reviewer_activity?

app/views/proposals/show.html.haml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
%span.bi.bi-pencil
77
Edit
88
- if proposal.speaker_can_withdraw?(current_user)
9-
= proposal.withdraw_button
9+
= link_to bang('Withdraw Proposal'), withdraw_event_proposal_path(event, uuid: proposal), data: {turbo: true, turbo_method: :post, turbo_confirm: 'This will remove your talk from consideration and send an email to the event coordinator. Are you sure you want to do this?'}, class: 'btn btn-warning', id: 'withdraw'
1010
- if proposal.speaker_can_delete?(current_user)
1111
= link_to event_proposal_path(event, uuid: proposal), data: {turbo: true, turbo_method: :delete, turbo_confirm: 'This will delete your talk. Are you sure you want to do this? It can not be undone.'}, class: 'btn btn-warning', id: 'delete' do
1212
%span.bi.bi-exclamation-circle
@@ -94,8 +94,8 @@
9494
.widget-header
9595
%h2 Confirm participation in #{proposal.event.name}
9696
.widget-content
97-
= proposal.confirm_button
98-
= proposal.decline_button
97+
= link_to 'Confirm', confirm_event_proposal_path(event, uuid: proposal), data: {turbo: true, turbo_method: :post}, class: 'btn btn-success'
98+
= link_to bang('Decline'), decline_event_proposal_path(event, uuid: proposal), data: {turbo: true, turbo_method: :post, turbo_confirm: 'This will remove your talk from consideration and notify the event staff. Are you sure you want to do this?'}, class: 'btn btn-warning'
9999
- elsif proposal.confirmed?
100100
.widget.widget-card
101101
.widget-content

app/views/shared/proposals/_inline_format_edit.html.haml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
= f.input :format,
33
required: false,
44
label_html: {class: 'info-item-heading'},
5-
collection: proposal.format_options,
5+
collection: proposal.event.session_formats.map { |sf| [sf.name, sf.id] }.sort,
66
selected: proposal.session_format_id,
77
id: 'track',
88
input_html: {class: 'proposal-format-select form-control select', data: {target_path: event_staff_program_proposal_update_session_format_path(proposal.event, proposal), select_type: 'format', action: 'change->proposal-select#change'}},

app/views/shared/proposals/_inline_track_edit.html.haml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
= f.input :track,
44
required: false,
55
label_html: {class: 'info-item-heading'},
6-
collection: proposal.track_options,
6+
collection: proposal.event.tracks.map { |t| [t.name, t.id] }.sort,
77
include_blank: Track::NO_TRACK,
88
selected: proposal.track_id,
99
id: 'track',

app/views/staff/proposal_reviews/_reviewer_contents.html.haml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.proposal-section
22
%h3.control-label Abstract
33
.markdown{ data: { 'field-id' => 'proposal_abstract' } }
4-
= proposal.abstract_markdown
4+
= markdown proposal.abstract
55

66
%h2.fieldset-legend For Review Committee
77

0 commit comments

Comments
 (0)