Skip to content

Commit

Permalink
Add the language to the bookmark links.
Browse files Browse the repository at this point in the history
  • Loading branch information
j-jorge committed Mar 15, 2018
1 parent 2ceb4a5 commit 6548bb4
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/controllers/bookmarks_controller.rb
Expand Up @@ -75,7 +75,7 @@ def destroy
protected

def bookmark_params
params.require(:bookmark).permit(:title, :link, :cc_licensed)
params.require(:bookmark).permit(:title, :link, :lang, :cc_licensed)
end

def find_bookmark
Expand Down
1 change: 1 addition & 0 deletions app/models/bookmark.rb
Expand Up @@ -8,6 +8,7 @@
# cached_slug :string(165)
# owner_id :integer
# link :string(1024)
# lang :string(2) not null
# created_at :datetime
# updated_at :datetime
#
Expand Down
4 changes: 3 additions & 1 deletion app/views/bookmarks/_bookmark.html.haml
@@ -1,6 +1,8 @@
= article_for bookmark do |c|
- c.title = "#{link_to "Lien", "/liens", class: "topic"} #{link_to bookmark.title, [bookmark.owner, bookmark]}".html_safe
- c.image = avatar_img(bookmark.owner)
- c.body = "#{link_to bookmark.link}".html_safe
- c.body = capture do
%ul
%li{lang: bookmark.lang}= "#{link_to bookmark.link, bookmark.link, hreflang: bookmark.lang}".html_safe
- if current_account && current_account.can_update?(bookmark)
- c.actions = link_to("Modifier", edit_user_bookmark_path(user_id: bookmark.owner, id: bookmark), class: 'action')
3 changes: 3 additions & 0 deletions app/views/bookmarks/_form.html.haml
Expand Up @@ -3,6 +3,9 @@
%p
= form.label :link, "Lien à partager"
= form.text_field :link, autocomplete: 'off', required: 'required', spellcheck: 'false', maxlength: 1024
%p
= form.label :lang, "Langue"
= form.select :lang, Lang.all
%p
= form.label :title, "Sujet du lien"
= form.text_field :title, autocomplete: 'off', required: 'required', spellcheck: 'true', maxlength: 100
Expand Down
4 changes: 3 additions & 1 deletion app/views/bookmarks/_preview.html.haml
@@ -1,4 +1,6 @@
= article_for preview do |c|
- c.title = "#{link_to "Lien", "/liens", class: "topic"} #{link_to spellcheck(preview.title), "#"}".html_safe
- c.image = avatar_img(preview.node.user)
- c.body = "#{link_to preview.link}".html_safe
- c.body = capture do
%ul
%li{lang: preview.lang}= "#{link_to preview.link, preview.link, hreflang: preview.lang}".html_safe
1 change: 1 addition & 0 deletions db/schema.rb
Expand Up @@ -111,6 +111,7 @@
t.string "cached_slug", limit: 165
t.integer "owner_id", limit: 4
t.string "link", limit: 1024, null: false
t.string "lang", limit: 2, null: false
t.datetime "created_at"
t.datetime "updated_at"
end
Expand Down

0 comments on commit 6548bb4

Please sign in to comment.