Merge pull request #1127 from Ana06/markdown

Markdown
This commit is contained in:
Christian Bruckmayer 2016-08-12 11:55:05 +02:00 committed by GitHub
commit 308c15f0ff
14 changed files with 21 additions and 33 deletions

View file

@ -25,15 +25,6 @@ class EventSerializer < ActiveModel::Serializer
object.track.try(:guid) object.track.try(:guid)
end end
def abstract
# This should never happen
if object.abstract.blank?
nil
else
simple_format(object.abstract).gsub('\n', '')
end
end
def length def length
object.event_type.try(:length) || EventType::LENGTH_STEP object.event_type.try(:length) || EventType::LENGTH_STEP
end end

View file

@ -6,12 +6,4 @@ class SpeakerSerializer < ActiveModel::Serializer
def name def name
object.name object.name
end end
def biography
if object.biography.blank?
nil
else
simple_format(object.biography).gsub('\n', '')
end
end
end end

View file

@ -133,7 +133,7 @@
%td %td
%b Biography %b Biography
%td %td
= simple_format(@event.submitter.biography) = markdown(@event.submitter.biography)
%tr %tr
%td %td
%b Submitted on %b Submitted on
@ -145,7 +145,7 @@
%tr %tr
%td %td
%b Abstract %b Abstract
%td= simple_format(@event.abstract) %td= markdown(@event.abstract)
%tr %tr
%td %td
%b Description %b Description

View file

@ -4,6 +4,7 @@
= f.input :name, :as => :string = f.input :name, :as => :string
= f.input :email = f.input :email
= f.input :affiliation, :as => :string = f.input :affiliation, :as => :string
= f.input :biography, :input_html => {:rows => 10} = f.input :biography, input_html: { rows: 10, data: { provide: 'markdown-editable' } },
hint: markdown_hint
= f.actions do = f.actions do
= f.action :submit, :button_html => {:class => "btn btn-primary"} = f.action :submit, :button_html => {:class => "btn btn-primary"}

View file

@ -29,6 +29,9 @@
- if attr == 'roles' - if attr == 'roles'
%td %td
= show_roles(@user.get_roles) = show_roles(@user.get_roles)
- elsif attr == 'biography'
%td
= markdown(@user.biography)
- else - else
%td= @user.send(attr) %td= @user.send(attr)
#submissions-content.tab-pane{class: "#{'active' if params[:tab] == 'submissions-content'}"} #submissions-content.tab-pane{class: "#{'active' if params[:tab] == 'submissions-content'}"}

View file

@ -39,7 +39,7 @@
%p.text-center %p.text-center
%b= event.title %b= event.title
%h5.text-center %h5.text-center
= simple_format truncate(event.abstract, length: 500, separator: ' ') = markdown truncate(event.abstract, length: 500, separator: ' ')
= link_to "Read More", conference_program_proposal_path(@conference.short_title, event) = link_to "Read More", conference_program_proposal_path(@conference.short_title, event)
= content_for :splash_nav do = content_for :splash_nav do

View file

@ -33,8 +33,8 @@
%span{ class: 'help-block select-help-text collapse event_difficulty_level_id', id: "#{difficulty_level.id}-help" } %span{ class: 'help-block select-help-text collapse event_difficulty_level_id', id: "#{difficulty_level.id}-help" }
= difficulty_level.description = difficulty_level.description
= f.input :abstract, input_html: { rows: 5 }, = f.input :abstract, required: true, input_html: { rows: 5, data: { provide: 'markdown-editable' } },
required: true, hint: link_to('Tips to improve your presentations', 'http://blog.hubspot.com/blog/tabid/6307/bid/5975/10-Rules-to-Instantly-Improve-Your-Presentations.aspx') hint: markdown_hint(link_to('Tips to improve your presentations.', 'http://blog.hubspot.com/blog/tabid/6307/bid/5975/10-Rules-to-Instantly-Improve-Your-Presentations.aspx'))
%p %p
You have used You have used

View file

@ -43,8 +43,8 @@
:javascript :javascript
$("##{@program.event_types.first.id}-help").collapse('show'); $("##{@program.event_types.first.id}-help").collapse('show');
= f.input :abstract, input_html: { rows: 5, required: true }, = f.input :abstract, required: true, input_html: { rows: 5, data: { provide: 'markdown-editable' } },
required: true, hint: link_to('Tips to improve your presentations', 'http://blog.hubspot.com/blog/tabid/6307/bid/5975/10-Rules-to-Instantly-Improve-Your-Presentations.aspx') hint: markdown_hint(link_to('Tips to improve your presentations.', 'http://blog.hubspot.com/blog/tabid/6307/bid/5975/10-Rules-to-Instantly-Improve-Your-Presentations.aspx'))
%p %p
You have used You have used

View file

@ -36,7 +36,7 @@
from from
= @speaker.affiliation = @speaker.affiliation
-if @speaker.biography? -if @speaker.biography?
= simple_format(@speaker.biography) = markdown(@speaker.biography)
.col-md-9 .col-md-9
.row .row
.col-md-12 .col-md-12
@ -64,7 +64,7 @@
.row .row
.col-md-12 .col-md-12
%p %p
= simple_format(@event.abstract) = markdown(@event.abstract)
%dl#proposal-info %dl#proposal-info
.col-md-12 .col-md-12
%dt Date: %dt Date:

View file

@ -12,7 +12,7 @@
%h4 %h4
presented by #{event.speaker_names} presented by #{event.speaker_names}
%p %p
= truncate(event.abstract, :length => 400) = markdown(truncate(event.abstract, :length => 400))
= link_to 'more', conference_program_proposal_path(@conference.short_title, event.id) if event.abstract.length > 400 = link_to 'more', conference_program_proposal_path(@conference.short_title, event.id) if event.abstract.length > 400
- if event_schedule.present? - if event_schedule.present?
%span.track %span.track

View file

@ -14,7 +14,8 @@
= link_to 'Change your avatar here', 'https://gravatar.com' = link_to 'Change your avatar here', 'https://gravatar.com'
= f.input :affiliation, as: :string, = f.input :affiliation, as: :string,
hint: 'This could be a company, a user group, or nothing at all.' hint: 'This could be a company, a user group, or nothing at all.'
= f.input :biography, input_html: { rows: 5, 'onkeyup' => "word_count(this, 'biography-count', 150)" } = f.input :biography, input_html: { rows: 5, data: { provide: 'markdown-editable' }, 'onkeyup' => "word_count(this, 'biography-count', 150)" },
hint: markdown_hint
You have used You have used
%span#bio_length %span#bio_length
= @user.biography ? @user.biography.split.length : 0 = @user.biography ? @user.biography.split.length : 0

View file

@ -8,7 +8,7 @@
%small %small
= @user.nickname = @user.nickname
%p %p
= @user.biography = markdown(@user.biography)
.row .row
.col-md-12 .col-md-12
- if @user.events.confirmed.any? - if @user.events.confirmed.any?

View file

@ -12,7 +12,7 @@ describe EventSerializer, type: :serializer do
length: 30, length: 30,
scheduled_date: '', scheduled_date: '',
language: nil, language: nil,
abstract: '<p>Lorem ipsum dolor sit amet</p>', abstract: 'Lorem ipsum dolor sit amet',
speaker_ids: [], speaker_ids: [],
type: 'Example Event Type', type: 'Example Event Type',
room: nil, room: nil,
@ -44,7 +44,7 @@ describe EventSerializer, type: :serializer do
length: 30, length: 30,
scheduled_date: ' 2014-03-04T00:00:00+0000 ', scheduled_date: ' 2014-03-04T00:00:00+0000 ',
language: 'English', language: 'English',
abstract: '<p>Lorem ipsum dolor sit amet</p>', abstract: 'Lorem ipsum dolor sit amet',
speaker_ids: [speaker.user.id], speaker_ids: [speaker.user.id],
type: 'Example Event Type', type: 'Example Event Type',
room: room.guid, room: room.guid,

View file

@ -25,7 +25,7 @@ describe SpeakerSerializer, type: :serializer do
speaker: { speaker: {
name: 'John Doe', name: 'John Doe',
affiliation: 'JohnDoesInc', affiliation: 'JohnDoesInc',
biography: '<p>Doest of all Jon Does</p>' biography: 'Doest of all Jon Does'
} }
}.to_json }.to_json