lots of path fixing
This commit is contained in:
parent
8ddc7a01c8
commit
4136eaf282
@ -1,2 +1,2 @@
|
||||
//= link_directory ../stylesheets/merged .css
|
||||
//= link merged/application.css
|
||||
//= link ../stylesheets/merged/application.css
|
||||
|
@ -8,7 +8,7 @@ module Merged
|
||||
|
||||
def create
|
||||
new_image = Image.create_new(params['filename'] , params['image_file'])
|
||||
redirect = :merge_images
|
||||
redirect = :merged_images
|
||||
if(params[:redirect])
|
||||
redirect = params[:redirect].gsub("NEW" ,new_image.name)
|
||||
puts "image redirect #{redirect}"
|
||||
|
@ -1,6 +1,6 @@
|
||||
module Merged
|
||||
class MergedController < ApplicationController
|
||||
layout 'merge_layout'
|
||||
layout 'merged_layout'
|
||||
|
||||
end
|
||||
end
|
||||
|
@ -9,7 +9,7 @@ module Merged
|
||||
def set_image
|
||||
@section.content["image"] = params[:image]
|
||||
@page.save
|
||||
redirect_to merge_page_section_url(@page.id,@section.id)
|
||||
redirect_to page_section_url(@page.id,@section.id)
|
||||
end
|
||||
|
||||
def update
|
||||
@ -21,7 +21,7 @@ module Merged
|
||||
end
|
||||
end
|
||||
@page.save
|
||||
redirect_to :merge_page_section
|
||||
redirect_to :merged_page_section
|
||||
end
|
||||
|
||||
private
|
||||
|
@ -1,7 +1,7 @@
|
||||
module Merged::SectionHelper
|
||||
|
||||
def section_form(options)
|
||||
url = merge_page_section_url( @page.id , @section.id)
|
||||
url = page_section_url( @page.id , @section.id)
|
||||
puts "URL #{url}"
|
||||
form_tag( url , {method: :patch}) do
|
||||
yield
|
||||
|
@ -19,7 +19,8 @@ module Merged
|
||||
|
||||
def self.all
|
||||
return @@images unless @@images.empty?
|
||||
Dir[Rails.root.join Image.asset_root + "*.*"].each do |f|
|
||||
dir = Rails.root.join Image.asset_root + "/*.*"
|
||||
Dir[dir].each do |f|
|
||||
file = f.split("/").last
|
||||
self.add( file )
|
||||
end
|
||||
|
@ -4,7 +4,7 @@ module Merged
|
||||
include ActiveModel::Conversion
|
||||
extend ActiveModel::Naming
|
||||
|
||||
@@root
|
||||
@@root = "cms"
|
||||
@@files = Set.new Dir.new(Rails.root.join(@@root)).children
|
||||
|
||||
attr_reader :name , :content
|
||||
|
@ -23,10 +23,10 @@
|
||||
%nav.hidden.md:block{"aria-label" => "Site Nav"}
|
||||
%ul.flex.items-center.gap-6.text-sm
|
||||
%li
|
||||
%a.text-gray-500.transition{:class => "hover:text-gray-500/75", :href => merge_pages_path}
|
||||
%a.text-gray-500.transition{:class => "hover:text-gray-500/75", :href => pages_path}
|
||||
Pages
|
||||
%li
|
||||
%a.text-gray-500.transition{:class => "hover:text-gray-500/75", :href => merge_images_path}
|
||||
%a.text-gray-500.transition{:class => "hover:text-gray-500/75", :href => images_path}
|
||||
Images
|
||||
%li
|
||||
%a.text-gray-500.transition{:class => "hover:text-gray-500/75", :href => "/merged/styles"}
|
@ -6,7 +6,7 @@
|
||||
%h5.mt-4.text-lg.font-bold Name is optional
|
||||
%p will be taken from uploaded file
|
||||
= file_field_tag 'image_file'
|
||||
.inline-block.rounded.border.border-indigo-600.bg-indigo-600.px-12.py-3.text-sm.font-medium.text-white.hover:bg-transparent.hover:text-indigo-600.focus:outline-none.focus:ring.active:text-indigo-500{:href => new_merge_image_path}
|
||||
.inline-block.rounded.border.border-indigo-600.bg-indigo-600.px-12.py-3.text-sm.font-medium.text-white.hover:bg-transparent.hover:text-indigo-600.focus:outline-none.focus:ring.active:text-indigo-500{:href => merged.new_image_path}
|
||||
= submit_tag 'Submit'
|
||||
-@images.each do |name , image|
|
||||
.relative.block.border.border-gray-100
|
||||
|
@ -1,9 +1,9 @@
|
||||
= form_for @merge_page do |f|
|
||||
- if @merge_page.errors.any?
|
||||
= form_for @merged_page do |f|
|
||||
- if @merged_page.errors.any?
|
||||
#error_explanation
|
||||
%h2= "#{pluralize(@merge_page.errors.count, "error")} prohibited this merge_page from being saved:"
|
||||
%h2= "#{pluralize(@merged_page.errors.count, "error")} prohibited this merged_page from being saved:"
|
||||
%ul
|
||||
- @merge_page.errors.full_messages.each do |message|
|
||||
- @merged_page.errors.full_messages.each do |message|
|
||||
%li= message
|
||||
|
||||
.actions
|
||||
|
@ -1,7 +1,7 @@
|
||||
%h1 Editing #{@merge_page.name}
|
||||
%h1 Editing #{@merged_page.name}
|
||||
|
||||
= render 'form'
|
||||
|
||||
= link_to 'Show', merge_page_url(@merge_page.name)
|
||||
= link_to 'Show', merged_page_url(@merged_page.name)
|
||||
\|
|
||||
= link_to 'Back', merge_pages_path
|
||||
= link_to 'Back', merged_pages_path
|
||||
|
@ -14,20 +14,20 @@
|
||||
%th.whitespace-nowrap.px-4.py-2.text-left.font-medium.text-gray-900
|
||||
Status
|
||||
%tbody.divide-y.divide-gray-200
|
||||
- @pages.each do |merge_page|
|
||||
- @pages.each do |merged_page|
|
||||
%tr
|
||||
%td.whitespace-nowrap.px-4.py-2.text-gray-700
|
||||
= link_to merge_page.name , merge_page_path(merge_page.name)
|
||||
= link_to merged_page.name , page_path(merged_page.name)
|
||||
%td.whitespace-nowrap.px-4.py-2.text-gray-700
|
||||
= merge_page.first_template
|
||||
= merged_page.first_template
|
||||
%td.whitespace-nowrap.px-4.py-2.text-gray-700
|
||||
= merge_page.content.length
|
||||
= merged_page.content.length
|
||||
%td.whitespace-nowrap.px-4.py-2
|
||||
%strong.rounded.bg-green-100.px-3.text-xs.font-medium.text-green-700{:class => "py-1.5"}
|
||||
= link_to 'Show', merge_page_path(merge_page.name)
|
||||
= link_to 'Show', page_path(merged_page.name)
|
||||
%strong.rounded.bg-amber-100.px-3.text-xs.font-medium.text-amber-700{:class => "py-1.5"}
|
||||
= link_to 'Edit', edit_merge_page_path(merge_page.name)
|
||||
= link_to 'Edit', edit_page_path(merged_page.name)
|
||||
|
||||
%section
|
||||
%a.inline-block.rounded.border.border-indigo-600.bg-indigo-600.px-12.py-3.text-sm.font-medium.text-white.hover:bg-transparent.hover:text-indigo-600.focus:outline-none.focus:ring.active:text-indigo-500{:href => new_merge_page_path}
|
||||
%a.inline-block.rounded.border.border-indigo-600.bg-indigo-600.px-12.py-3.text-sm.font-medium.text-white.hover:bg-transparent.hover:text-indigo-600.focus:outline-none.focus:ring.active:text-indigo-500{:href => new_page_path}
|
||||
New Page
|
||||
|
@ -1,5 +1,5 @@
|
||||
%h1 New merge_page
|
||||
%h1 New merged_page
|
||||
|
||||
= render 'form'
|
||||
|
||||
= link_to 'Back', merge_pages_path
|
||||
= link_to 'Back', pages_path
|
||||
|
@ -15,7 +15,7 @@
|
||||
%button.mt-4.rounded-lg.bg-yellow-500.p-4
|
||||
=link_to "Down" , "/index"
|
||||
%button.mt-4.rounded-lg.bg-blue-400.p-4
|
||||
=link_to "Edit" , merge_page_section_path(@page.name , section.id)
|
||||
=link_to "Edit" , page_section_path(@page.name , section.id)
|
||||
%button.mt-4.rounded-lg.bg-cyan-400.p-4
|
||||
=link_to "New" , "/index"
|
||||
%button.mt-4.rounded-lg.bg-red-400.p-4
|
||||
|
@ -1,9 +1,9 @@
|
||||
= form_for @merge_section do |f|
|
||||
- if @merge_section.errors.any?
|
||||
= form_for @merged_section do |f|
|
||||
- if @merged_section.errors.any?
|
||||
#error_explanation
|
||||
%h2= "#{pluralize(@merge_section.errors.count, "error")} prohibited this merge_section from being saved:"
|
||||
%h2= "#{pluralize(@merged_section.errors.count, "error")} prohibited this merged_section from being saved:"
|
||||
%ul
|
||||
- @merge_section.errors.full_messages.each do |message|
|
||||
- @merged_section.errors.full_messages.each do |message|
|
||||
%li= message
|
||||
|
||||
.actions
|
||||
|
@ -1,7 +1,7 @@
|
||||
%h1 Editing merge_section
|
||||
%h1 Editing merged_section
|
||||
|
||||
= render 'form'
|
||||
|
||||
= link_to 'Show', @merge_section
|
||||
= link_to 'Show', @merged_section
|
||||
\|
|
||||
= link_to 'Back', merge_sections_path
|
||||
= link_to 'Back', merged_sections_path
|
||||
|
@ -1,6 +1,6 @@
|
||||
.relative.block.border.border-gray-100
|
||||
%h3.mt-4.text-lg.font-bold= key.upcase
|
||||
= section_form( class: "mx-auto mt-8 mb-0 max-w space-y-4") do
|
||||
= text_field_tag( :header , @section.content["header"], class: "w-full.rounded-lg.border-gray-200.p-4.pr-12.text-sm.shadow-sm")
|
||||
= text_field_tag( :header , @section.content["header"], class: "w-full rounded-lg border-gray-200 p-4 pr-12 text-sm shadow-sm")
|
||||
%button.ml-3.inline-block.rounded-lg.bg-blue-500.px-5.py-3.text-sm.font-medium.text-white{:type => "submit"}
|
||||
Update
|
||||
|
@ -1,9 +1,9 @@
|
||||
.relative.block.border.border-gray-100
|
||||
%h3.mt-4.text-lg.font-bold= key.upcase
|
||||
%button.ml-3.inline-block.rounded-lg.bg-blue-500.px-5.py-3.text-md.font-medium.text-white
|
||||
=link_to "Change Image" , merge_page_section_select_image_url(@page.name,@section.id)
|
||||
=link_to "Change Image" , page_section_select_image_url(@page.name,@section.id)
|
||||
%button.ml-3.inline-block.rounded-lg.bg-red-500.px-5.py-3.text-md.font-medium.text-white
|
||||
= link_to( "Remove image" , merge_page_section_set_image_path( @page.name, @section.id , image: ""))
|
||||
= link_to( "Remove image" , page_section_set_image_path( @page.name, @section.id , image: ""))
|
||||
|
||||
|
||||
.relative.block.border.border-gray-100
|
||||
|
@ -1,4 +1,4 @@
|
||||
%h1 Listing merge_sections
|
||||
%h1 Listing merged_sections
|
||||
|
||||
%table
|
||||
%thead
|
||||
@ -8,12 +8,12 @@
|
||||
%th
|
||||
|
||||
%tbody
|
||||
- @merge_sections.each do |merge_section|
|
||||
- @merged_sections.each do |merged_section|
|
||||
%tr
|
||||
%td= link_to 'Show', merge_section
|
||||
%td= link_to 'Edit', edit_merge_section_path(merge_section)
|
||||
%td= link_to 'Destroy', merge_section, method: :delete, data: { confirm: 'Are you sure?' }
|
||||
%td= link_to 'Show', merged_section
|
||||
%td= link_to 'Edit', edit_merged_section_path(merged_section)
|
||||
%td= link_to 'Destroy', merged_section, method: :delete, data: { confirm: 'Are you sure?' }
|
||||
|
||||
%br
|
||||
|
||||
= link_to 'New Section', new_merge_section_path
|
||||
= link_to 'New Section', new_merged_section_path
|
||||
|
@ -1,5 +1,5 @@
|
||||
%h1 New merge_section
|
||||
%h1 New merged_section
|
||||
|
||||
= render 'form'
|
||||
|
||||
= link_to 'Back', merge_sections_path
|
||||
= link_to 'Back', merged_sections_path
|
||||
|
@ -1,15 +1,15 @@
|
||||
.grid.grid-cols-6.gap-2.m-8
|
||||
.relative.block.border.border-gray-100
|
||||
%h3.mt-4.text-lg.font-bold Add new image or select (click)
|
||||
= form_tag(merge_images_path, multipart: true) do
|
||||
= form_tag(merged.images_path, multipart: true) do
|
||||
= text_field_tag 'filename'
|
||||
%h5.mt-4.text-lg.font-bold Name is optional
|
||||
%p will be taken from uploaded file
|
||||
= hidden_field_tag :redirect , merge_page_section_set_image_url(@page.name,@section.id,image: "NEW")
|
||||
= hidden_field_tag :redirect , page_section_set_image_url(@page.name,@section.id,image: "NEW")
|
||||
= file_field_tag 'image_file'
|
||||
.inline-block.rounded.border.border-indigo-600.bg-indigo-600.px-12.py-3.text-sm.font-medium.text-white.hover:bg-transparent.hover:text-indigo-600.focus:outline-none.focus:ring.active:text-indigo-500{:href => new_merge_image_path}
|
||||
.inline-block.rounded.border.border-indigo-600.bg-indigo-600.px-12.py-3.text-sm.font-medium.text-white.hover:bg-transparent.hover:text-indigo-600.focus:outline-none.focus:ring.active:text-indigo-500{:href => merged.new_image_path}
|
||||
= submit_tag 'Submit'
|
||||
-@images.each do |name , image|
|
||||
.relative.block.border.border-gray-100
|
||||
= link_to( merge_page_section_set_image_path( image: name)) do
|
||||
= link_to( page_section_set_image_path( image: name)) do
|
||||
=image_tag("cms/#{name}" , class: "h-56 w-full object-contain lg:h-72")
|
||||
|
@ -13,6 +13,6 @@
|
||||
- @section.content.each do |key , value|
|
||||
= render "merged/sections/editors/#{key}", section: @section , key: key , value: value
|
||||
|
||||
= #link_to 'Edit', edit_merge_section_path(@merge_section)
|
||||
= #link_to 'Edit', edit_merged_section_path(@merged_section)
|
||||
\|
|
||||
= #link_to 'Back', merge_sections_path
|
||||
= #link_to 'Back', merged_sections_path
|
||||
|
@ -2,8 +2,18 @@ module Merged
|
||||
class Engine < ::Rails::Engine
|
||||
isolate_namespace Merged
|
||||
initializer "merged.assets.precompile" do |app|
|
||||
app.config.assets.precompile += %w( merged/application.js merged/application.css )
|
||||
app.config.assets.precompile += %w( config/merged_manifest.js )
|
||||
add_image_assets(app.config , "section_preview")
|
||||
add_image_assets(app.config , "card_preview")
|
||||
end
|
||||
|
||||
private
|
||||
def add_image_assets(config , sub_dir )
|
||||
dir = Dir.new(Engine.root.join("app/assets/images/merged/" , sub_dir))
|
||||
dir.children.each do |file|
|
||||
kid = "merged/" + sub_dir + "/" + file
|
||||
config.assets.precompile << kid
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user