card image selection
This commit is contained in:
parent
5654bb0743
commit
5d4da2c032
@ -6,14 +6,10 @@ module Merged
|
|||||||
@section = Section.find(params[:section_id])
|
@section = Section.find(params[:section_id])
|
||||||
end
|
end
|
||||||
|
|
||||||
def select_image
|
|
||||||
@images = Image.all
|
|
||||||
end
|
|
||||||
|
|
||||||
def set_image
|
def set_image
|
||||||
@card.image = params[:image]
|
@card.image_id = params[:image_id]
|
||||||
@card.save
|
@card.save
|
||||||
redirect_to section_cards_url(@card.section.id) , notice: "Image selected: #{@card.image}"
|
redirect_to section_cards_url(@card.section.id) , notice: "Image selected: #{@card.image.name}"
|
||||||
end
|
end
|
||||||
|
|
||||||
def move
|
def move
|
||||||
|
@ -35,6 +35,9 @@ module Merged
|
|||||||
if(params[:section_id])
|
if(params[:section_id])
|
||||||
return view_context.section_set_image_url(params[:section_id] , image_id: image.id)
|
return view_context.section_set_image_url(params[:section_id] , image_id: image.id)
|
||||||
end
|
end
|
||||||
|
if(params[:card_id])
|
||||||
|
return view_context.card_set_image_url(params[:card_id] , image_id: image.id)
|
||||||
|
end
|
||||||
view_context.image_url(image.id)
|
view_context.image_url(image.id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -20,6 +20,10 @@ module Merged
|
|||||||
section = Section.find(section_id)
|
section = Section.find(section_id)
|
||||||
"Select image for Section #{section.index} : #{section.header}"
|
"Select image for Section #{section.index} : #{section.header}"
|
||||||
end
|
end
|
||||||
|
def card_text
|
||||||
|
card = Card.find(card_id)
|
||||||
|
"Select image for Card #{card.index} : #{card.header}"
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -22,10 +22,9 @@
|
|||||||
=submit_button( "Delete" , true)
|
=submit_button( "Delete" , true)
|
||||||
.p-4
|
.p-4
|
||||||
%h3.mt-4.text-lg.font-bold Image
|
%h3.mt-4.text-lg.font-bold Image
|
||||||
= yellow_button("Change Image" , card_select_image_url(card.id) )
|
= yellow_button("Change Image" , images_url(card_id: card.id) )
|
||||||
= red_button("Remove image", card_set_image_path( card.id , image: "") )
|
= red_button("Remove image", card_set_image_path( card.id , image: "") )
|
||||||
|
|
||||||
|
|
||||||
.basis-96
|
.basis-96
|
||||||
%h3.mt-4.text-lg.font-bold Image
|
%h3.mt-4.text-lg.font-bold Image
|
||||||
-if( card.image.blank? )
|
-if( card.image.blank? )
|
||||||
|
@ -11,7 +11,7 @@ module Merged
|
|||||||
expect(first.class).to be Image
|
expect(first.class).to be Image
|
||||||
end
|
end
|
||||||
it "has name" do
|
it "has name" do
|
||||||
expect(first.name).to eq "common_spaces"
|
expect(first.name).to eq "Common spaces"
|
||||||
end
|
end
|
||||||
it "has height and width" do
|
it "has height and width" do
|
||||||
expect(first.height).to eq 300
|
expect(first.height).to eq 300
|
||||||
|
Loading…
x
Reference in New Issue
Block a user