This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Webpage < ActiveRecord::Base | |
belongs_to :dropdown | |
has_many :contents, :order => "parent_id, layout_order" | |
end | |
class Content < ActiveRecord::Base | |
belongs_to :element | |
belongs_to :webpage | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module WebpagesHelper | |
def display_html_content(contents, mode = nil) | |
completed_elements, dropzone_id_list, sortable_list, output = [], [], [], [] | |
contents.map do |c| | |
unless completed_elements.include?(c.id) | |
result = get_nested_elements(c, contents, completed_elements, dropzone_id_list, sortable_list, mode) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'polaroid.rb' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def shipping_label | |
@from_address = Setting.find_by_name("shipping_from_address").address | |
@to_address = Address.find(params[:file_name].split("_").last) | |
prawnto :prawn => { | |
:page_layout => :landscape, | |
:page_size => [79.2, 252.0], | |
:left_margin => 0, | |
:right_margin => 0, | |
:top_margin => 0, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
acts_as_fleximage do | |
image_directory "/media/master_images" | |
use_creation_date_based_directories true | |
# image_storage_format :jpg # the plugin is handling this now | |
require_image true | |
missing_image_message 'is required' | |
invalid_image_message 'was not a readable image' | |
# default_image_path 'public/images/image_not_available.png' | |
default_image nil |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def file_path | |
# -- I changed this line from: -- | |
# "#{directory_path}/#{id}.#{self.class.image_storage_format}" | |
"#{directory_path}/#{id}.#{self.server_format}" | |
end | |
def pre_save | |
if @uploaded_image | |
# perform preprocessing | |
perform_preprocess_operation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# controller action | |
def result_list | |
type = (params[:newsletter_id].to_i.zero? ? 'PdfList' : 'Newsletter').constantize | |
result_list = type.find(params[:result_list_id]) | |
unless result_list.in_progress? | |
call_rake :result_list, :function => params[:submit_button], | |
:result_list_id => result_list.id, | |
:search => (params[:search].blank? ? nil : params[:search].strip), | |
:search_scope => params[:search_scope], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Photo | |
belongs_to :photo_album | |
def set_cover(cover) | |
if cover | |
photo_album.cover = self | |
elsif photo_album.cover.nil? | |
# set album cover to first photo album if no cover has been set. | |
photo_album.cover = photo_album.photos.first |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def set_cover(should_be_cover, photo) | |
if should_be_cover | |
cover = photo | |
elsif cover.nil? | |
# set album cover to first photo album if no cover has been set. | |
cover = photos.first | |
end | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Admin::PhotosController < Admin::TablesController | |
cache_sweeper :photo_sweeper, :only => [:create, :update, :destroy] | |
# standard methods for index, show, new, edit, update, destroy | |
end |
OlderNewer