mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
Add markdown to users biography
Closes https://github.com/openSUSE/osem/issues/1090 Closes https://github.com/openSUSE/osem/issues/701
This commit is contained in:
parent
72cd463dc7
commit
eee4e4f22c
8 changed files with 11 additions and 14 deletions
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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"}
|
||||||
|
|
|
||||||
|
|
@ -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'}"}
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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?
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue