From 4a51931428312ab565cc843fe38840f1a9207c20 Mon Sep 17 00:00:00 2001 From: Kevin Young Date: Mon, 5 Nov 2018 19:38:18 -0500 Subject: [PATCH 1/2] removes span tags from permalink and adds live page link on node edit page --- .../views/push_type/admin/nodes/_form_fields.html.haml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/admin/app/views/push_type/admin/nodes/_form_fields.html.haml b/admin/app/views/push_type/admin/nodes/_form_fields.html.haml index 41ca4b4f..47b6d7b0 100644 --- a/admin/app/views/push_type/admin/nodes/_form_fields.html.haml +++ b/admin/app/views/push_type/admin/nodes/_form_fields.html.haml @@ -14,10 +14,12 @@ .columns{ :'v-bind:class' => '{visible: node.slug}' } %span.key Permalink %span.value - %span.show-for-medium-up http://#{ request.host_with_port }/ - = content_tag :span, @node.parent.permalink+'/' if @node.parent - %span {{ node.slug }} + %span.show-for-medium-up + = "http://#{request.host_with_port}/#{@node.parent.permalink + '/' if @node.parent}#{@node.slug}" %button.button.tiny.radius.secondary{ data: { dropdown: 'slug-field' } } Edit + - if @node.published? + %a.button.tiny.radius{class: "primary", href: "http://#{request.host_with_port}/#{@node.parent.permalink + '/' if @node.parent}#{@node.slug}"} + Live page #slug-field.f-dropdown.content{ data: { dropdown: { content: true } } } = f.label :slug = f.text_field :slug, :'v-model' => 'node.slug', :'v-on:keyup' => 'cleanSlug' From 0746f3b9f8991b0fe31663616f1b086ff08406ea Mon Sep 17 00:00:00 2001 From: Kevin Young Date: Tue, 11 Dec 2018 12:33:25 -0500 Subject: [PATCH 2/2] refactors common code into node_url helper method --- admin/app/helpers/push_type/admin_helper.rb | 4 ++++ admin/app/views/push_type/admin/nodes/_form_fields.html.haml | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/admin/app/helpers/push_type/admin_helper.rb b/admin/app/helpers/push_type/admin_helper.rb index 6375ec64..4ebdeb54 100644 --- a/admin/app/helpers/push_type/admin_helper.rb +++ b/admin/app/helpers/push_type/admin_helper.rb @@ -11,5 +11,9 @@ def ficon(kind, label = nil, opts = {}) [el, label].compact.join(' ').html_safe end + def node_url(node) + "http://#{request.host_with_port}/#{node.parent.permalink + '/' if node.parent}#{node.slug}" + end + end end diff --git a/admin/app/views/push_type/admin/nodes/_form_fields.html.haml b/admin/app/views/push_type/admin/nodes/_form_fields.html.haml index 47b6d7b0..667bc783 100644 --- a/admin/app/views/push_type/admin/nodes/_form_fields.html.haml +++ b/admin/app/views/push_type/admin/nodes/_form_fields.html.haml @@ -15,10 +15,10 @@ %span.key Permalink %span.value %span.show-for-medium-up - = "http://#{request.host_with_port}/#{@node.parent.permalink + '/' if @node.parent}#{@node.slug}" + = node_url(@node) %button.button.tiny.radius.secondary{ data: { dropdown: 'slug-field' } } Edit - if @node.published? - %a.button.tiny.radius{class: "primary", href: "http://#{request.host_with_port}/#{@node.parent.permalink + '/' if @node.parent}#{@node.slug}"} + %a.button.tiny.radius{class: "primary", href: node_url(@node)} Live page #slug-field.f-dropdown.content{ data: { dropdown: { content: true } } } = f.label :slug