Class: Breeze::ImagesController
Instance Method Summary
collapse
#authenticate_if, #current_member_email
Instance Method Details
#copy ⇒ Object
53
54
55
56
57
|
# File 'app/controllers/breeze/images_controller.rb', line 53
def copy
image = @image.copy
image.add_save(current_member_email)
redirect_to image_path(image.id) , notice: "Image copied"
end
|
#create ⇒ Object
59
60
61
62
63
64
|
# File 'app/controllers/breeze/images_controller.rb', line 59
def create
image = Image.create_new(params['filename'] ,params['tags'], params['image_file'])
image.add_save current_member_email
where_to = determine_redirect(image)
redirect_to where_to , notice: "New image created: #{image.name}"
end
|
#crop ⇒ Object
39
40
41
42
43
44
|
# File 'app/controllers/breeze/images_controller.rb', line 39
def crop
size = "#{params[:size_x]}x#{params[:size_y]}+#{params[:off_x]}+#{params[:off_y]}"
@image.crop( size )
@image.edit_save(current_member_email)
redirect_to image_path(@image) , notice: "Image was resized"
end
|
#destroy ⇒ Object
21
22
23
24
|
# File 'app/controllers/breeze/images_controller.rb', line 21
def destroy
@image.destroy(current_member_email)
redirect_to :images , notice: "Image #{@image.name} deleted"
end
|
#index ⇒ Object
7
8
9
10
11
12
13
14
15
16
17
18
19
|
# File 'app/controllers/breeze/images_controller.rb', line 7
def index
@images = get_images
@image_data = @images.collect{|i|
data = i.data.dup
data[:url] = view_context.asset_path(i.asset_name)
data[:link] = build_select_link_for(i)
data[:updated_at] = i.updated_at.to_date if i.updated_at
data[:created] = i.updated_at.to_i
data[:aspect_ratio] = i.aspect_ratio.join("/")
data[:ratio] = i.aspect_ratio
data
}
end
|
#scale ⇒ Object
33
34
35
36
37
|
# File 'app/controllers/breeze/images_controller.rb', line 33
def scale
@image.scale( params[:scale] )
@image.edit_save(current_member_email)
redirect_to image_path(@image) , notice: "Image was scaled"
end
|
#show ⇒ Object
46
47
48
49
50
51
|
# File 'app/controllers/breeze/images_controller.rb', line 46
def show
@sections = Section.find_all(:image_id, params[:id].to_i)
@cards = Card.find_all(:image_id, params[:id].to_i)
@used = ((@cards.length > 0) || (@sections.length > 0))
@image_data = @image.data
end
|
#update ⇒ Object
26
27
28
29
30
31
|
# File 'app/controllers/breeze/images_controller.rb', line 26
def update
@image.name = params[:name]
@image.tags = params[:tags]
@image.edit_save(current_member_email)
redirect_to image_path(@image) , notice: "Image updated"
end
|