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