Archive: ComponentOwl Rails app, DB backups, go redirect script
This commit is contained in:
11
app/helpers/about_helper.rb
Normal file
11
app/helpers/about_helper.rb
Normal file
@@ -0,0 +1,11 @@
|
||||
module AboutHelper
|
||||
|
||||
def years_since_founded
|
||||
Date.today.year - 2004
|
||||
end
|
||||
|
||||
def years_since_asp_member
|
||||
Date.today.year - 2006
|
||||
end
|
||||
|
||||
end
|
||||
2
app/helpers/activations_helper.rb
Normal file
2
app/helpers/activations_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
module ActivationsHelper
|
||||
end
|
||||
160
app/helpers/application_helper.rb
Normal file
160
app/helpers/application_helper.rb
Normal file
@@ -0,0 +1,160 @@
|
||||
# Methods added to this helper will be available to all templates in the application.
|
||||
module ApplicationHelper
|
||||
|
||||
def blv_version
|
||||
featured_product.current_version
|
||||
end
|
||||
|
||||
# ========== DEXTRONET_CORE_HELPER ===========
|
||||
|
||||
def antispam_field
|
||||
hidden_field_tag :magicwand, "you-shall-not-pass", :id => nil
|
||||
end
|
||||
|
||||
def link_to_new_window(name, options, html_options = {})
|
||||
html_options[:onclick] = [html_options[:onclick], "window.open(this.href); return false"].compact.join("; ")
|
||||
link_to(name, options, html_options);
|
||||
end
|
||||
|
||||
def back_button
|
||||
link_to t('txt.common.back'), root_path, :class => "back-header-button history-back"
|
||||
end
|
||||
|
||||
def releases_page_path(product, version = nil)
|
||||
p = product_path(product)+"/#{Settings.releases_code}"
|
||||
p << "?since=#{version}" if version
|
||||
p
|
||||
end
|
||||
|
||||
def submit_button(value, options = {})
|
||||
options[:class] = ["dbtn", options[:class]].compact.join(" ")
|
||||
btn_id = options.delete(:btn_id) || "send"
|
||||
btn_class = ["dbtn-c", options.delete(:btn_class)].compact.join(" ")
|
||||
content_tag(:span, content_tag(:span, submit_tag(value, options), :class => "dbtn-w"), :class => btn_class, :id => btn_id)
|
||||
end
|
||||
|
||||
# tady tyhle paths k product pages by mely byt generovane automaticky
|
||||
def story_path(product)
|
||||
product_path(product)+"/#{Settings.story_code}"
|
||||
end
|
||||
|
||||
def submit_image(*args)
|
||||
options = args.extract_options!
|
||||
|
||||
case args.first
|
||||
when Symbol, String
|
||||
options[:class] = [args.first, options[:class]].compact.join(" ")
|
||||
end
|
||||
|
||||
image_submit_tag("blank.gif", options)
|
||||
end
|
||||
|
||||
def screenshot_path(id)
|
||||
ss = Screenshot.find_by_id(id)
|
||||
ss ? ss.image.url : "/images/blank.gif"
|
||||
end
|
||||
|
||||
# ========== /DEXTRONET_CORE_HELPER ===========
|
||||
|
||||
def more_link_button(product_or_edition, klass = "standard", text = nil)
|
||||
text = t('txt.products.learn_more') unless text
|
||||
|
||||
case product_or_edition
|
||||
when ProductEdition
|
||||
path = product_path(product_or_edition.product)
|
||||
else
|
||||
path = product_path(product_or_edition)
|
||||
end
|
||||
|
||||
link_to text, path, :class => "#{klass}-more image-link"
|
||||
end
|
||||
|
||||
def documentation_path(product)
|
||||
"#{product_path(product)}/#{Settings.documentation_code}"
|
||||
end
|
||||
|
||||
def quick_start_guide_path(product)
|
||||
"#{product_path(product)}/#{Settings.quick_start_guide_code}"
|
||||
end
|
||||
|
||||
def class_reference_path(product)
|
||||
"#{product_path(product)}/#{Settings.class_reference_code}"
|
||||
end
|
||||
|
||||
|
||||
def pricing_path(product)
|
||||
"#{product_path(product)}/#{Settings.pricing_code}"
|
||||
end
|
||||
|
||||
def twitter_url
|
||||
"http://twitter.com/ComponentOwl"
|
||||
end
|
||||
|
||||
def upgrade_path(static_page_code)
|
||||
"/upgrade/#{StaticPage[static_page_code].url_param}"
|
||||
end
|
||||
|
||||
def buy_professional(product)
|
||||
edition = product.edition('professional')
|
||||
buy_link(edition, "buy_professional", t('txt.products.buy_professional', :price => number_to_currency(edition.price)))
|
||||
end
|
||||
|
||||
def buy_standard(product)
|
||||
edition = product.edition('standard')
|
||||
buy_link(edition, "buy_standard", t('txt.products.buy_standard', :price => number_to_currency(edition.price)))
|
||||
end
|
||||
|
||||
def subscription_lists(location_code, product = nil)
|
||||
product_id = product ? product.id : nil
|
||||
lists = SubscriptionLocation[location_code].lists(product_id)
|
||||
product_list = lists.detect {|l| l.product == product }
|
||||
can_deselect = false
|
||||
content = []
|
||||
lists.each do |list|
|
||||
# zatim bude vsecko hidden
|
||||
#if !product || (product && list.product == product) || (product && product_list.nil?)
|
||||
content << hidden_field_tag("subscription[subscription_list_ids][]", list.id, :id => nil)
|
||||
#else
|
||||
# content << check_box_tag("subscription[subscription_list_ids][]", list.id, true, :id => "subscription_subscription_list_ids_#{list.id}")
|
||||
# content << label_tag("subscription_subscription_list_ids_#{list.id}", t('txt.product.send_also', :newsletter => list.name))
|
||||
# can_deselect = true
|
||||
#end
|
||||
end
|
||||
if can_deselect
|
||||
content.insert(0, '<div class="subscription-lists">')
|
||||
content << "</div>"
|
||||
end
|
||||
content.join("\n")
|
||||
end
|
||||
|
||||
def subscribe(type = nil, text = t('txt.common.subscribe'), options = {})
|
||||
btn_class = "subscribe"
|
||||
btn_class << " dbtn-#{type}" if type
|
||||
submit_button(text, options.merge(:btn_class => btn_class))
|
||||
end
|
||||
|
||||
def pricing_licensing?(product_page)
|
||||
product_page.code == "pricing-licensing"
|
||||
end
|
||||
|
||||
def cached_javascripts_base
|
||||
javascript_include_merged :base
|
||||
end
|
||||
|
||||
def cached_javascripts_app
|
||||
javascript_include_merged :app
|
||||
end
|
||||
|
||||
def cached_javascripts_simple
|
||||
javascript_include_merged :simple
|
||||
end
|
||||
|
||||
def cached_stylesheets_base
|
||||
stylesheet_link_merged :base
|
||||
end
|
||||
|
||||
def cached_stylesheets_simple
|
||||
stylesheet_link_merged :simple
|
||||
end
|
||||
|
||||
end
|
||||
2
app/helpers/articles_helper.rb
Normal file
2
app/helpers/articles_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
module ArticlesHelper
|
||||
end
|
||||
17
app/helpers/comics_helper.rb
Normal file
17
app/helpers/comics_helper.rb
Normal file
@@ -0,0 +1,17 @@
|
||||
module ComicsHelper
|
||||
|
||||
def title(comic = nil)
|
||||
comic ||= @comic
|
||||
t('txt.comics.title', :name => comic.name_or_date)
|
||||
end
|
||||
|
||||
def description(comic = nil)
|
||||
comic ||= @comic
|
||||
comic.story.present? ? comic.story : meta_tags.description
|
||||
end
|
||||
|
||||
def sitename
|
||||
t('txt.componentowl_long')
|
||||
end
|
||||
|
||||
end
|
||||
12
app/helpers/download_helper.rb
Normal file
12
app/helpers/download_helper.rb
Normal file
@@ -0,0 +1,12 @@
|
||||
module DownloadHelper
|
||||
|
||||
def quote(testimonial)
|
||||
text = @testimonial ? @testimonial.text : t('txt.download_page.quote_text')
|
||||
author = @testimonial ? @testimonial.author : t('txt.download_page.quote_author')
|
||||
content = ['<div class="quote">']
|
||||
content << "<blockquote>#{text}</blockquote>"
|
||||
content << "<em>#{author}</em>"
|
||||
content << "</div>"
|
||||
content.join("\n")
|
||||
end
|
||||
end
|
||||
12
app/helpers/faqs_helper.rb
Normal file
12
app/helpers/faqs_helper.rb
Normal file
@@ -0,0 +1,12 @@
|
||||
module FaqsHelper
|
||||
|
||||
def faqs_links(products, current_product = nil)
|
||||
content = []
|
||||
content << content_tag(:li, link_to(t("txt.faqs.general_faqs"), general_faqs_path)) if current_product
|
||||
for product in products
|
||||
content << content_tag(:li, link_to("#{product.name} #{t("txt.faqs.faqs")}", product_faqs_path(product))) if product.has_faqs? && product != current_product
|
||||
end
|
||||
return content.join
|
||||
end
|
||||
|
||||
end
|
||||
2
app/helpers/feeds_helper.rb
Normal file
2
app/helpers/feeds_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
module FeedsHelper
|
||||
end
|
||||
2
app/helpers/home_helper.rb
Normal file
2
app/helpers/home_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
module HomeHelper
|
||||
end
|
||||
2
app/helpers/landing_pages_helper.rb
Normal file
2
app/helpers/landing_pages_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
module LandingPagesHelper
|
||||
end
|
||||
21
app/helpers/notifier_helper.rb
Normal file
21
app/helpers/notifier_helper.rb
Normal file
@@ -0,0 +1,21 @@
|
||||
module NotifierHelper
|
||||
|
||||
def survey(survey)
|
||||
keys = survey.keys.sort {|x, y| x.to_i <=> y.to_i }
|
||||
questions = []
|
||||
|
||||
keys.each do |key|
|
||||
item = survey[key]
|
||||
str = "#{key}. #{item[:question]}\n"
|
||||
if item[:answer].is_a? Array
|
||||
str += item[:answer].join(", ")
|
||||
else
|
||||
str += item[:answer] || ""
|
||||
end
|
||||
questions << str
|
||||
end
|
||||
|
||||
questions.join("\n\n")
|
||||
end
|
||||
|
||||
end
|
||||
12
app/helpers/orders_helper.rb
Normal file
12
app/helpers/orders_helper.rb
Normal file
@@ -0,0 +1,12 @@
|
||||
module OrdersHelper
|
||||
|
||||
def buy(bmtid)
|
||||
#submit_image("buy", :name => "PRODUCTID", :value => bmtid, :onclick => "bmtForm(this)")
|
||||
submit_tag("", :name => "PRODUCTID", :"data-value" => bmtid, :onclick => "bmtForm(this)", :class => "buy")
|
||||
end
|
||||
|
||||
def renew(bmtid)
|
||||
#submit_image("renew", :name => "PRODUCTID", :value => bmtid, :onclick => "bmtForm(this)")
|
||||
submit_tag("", :name => "PRODUCTID", :"data-value" => bmtid, :onclick => "bmtForm(this)", :class => "renew")
|
||||
end
|
||||
end
|
||||
58
app/helpers/pad_helper.rb
Normal file
58
app/helpers/pad_helper.rb
Normal file
@@ -0,0 +1,58 @@
|
||||
module PadHelper
|
||||
|
||||
def val(key)
|
||||
@product.pad_value_for_key(key) || Settings.pad[key] || ""
|
||||
end
|
||||
|
||||
def product_link
|
||||
product_url(@product)
|
||||
end
|
||||
|
||||
def buy_link
|
||||
@product.free? ? product_url(@product) : order_url(@product)
|
||||
end
|
||||
|
||||
def pad_link
|
||||
pad_url(@product)
|
||||
end
|
||||
|
||||
def setup_file_link
|
||||
direct_download_url(:filename => @product.file_url)
|
||||
end
|
||||
|
||||
def name
|
||||
@product.name.strip_version
|
||||
end
|
||||
|
||||
def version
|
||||
@product.current_version
|
||||
end
|
||||
|
||||
def release_month
|
||||
@product.current_release.date.strftime("%m")
|
||||
end
|
||||
|
||||
def release_day
|
||||
@product.current_release.date.strftime("%d")
|
||||
end
|
||||
|
||||
def release_year
|
||||
@product.current_release.date.year
|
||||
end
|
||||
|
||||
def price
|
||||
@product.price || 0
|
||||
end
|
||||
|
||||
def size_b
|
||||
@product.setup_file.size
|
||||
end
|
||||
|
||||
def size_kb
|
||||
number_with_precision(@product.setup_file.size.to_f / 1024, :precision => 0)
|
||||
end
|
||||
|
||||
def size_mb
|
||||
number_with_precision(@product.setup_file.size.to_f / 1024 / 1024, :precision => 2)
|
||||
end
|
||||
end
|
||||
2
app/helpers/press_helper.rb
Normal file
2
app/helpers/press_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
module PressHelper
|
||||
end
|
||||
2
app/helpers/product_pages_helper.rb
Normal file
2
app/helpers/product_pages_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
module ProductPagesHelper
|
||||
end
|
||||
35
app/helpers/products_helper.rb
Normal file
35
app/helpers/products_helper.rb
Normal file
@@ -0,0 +1,35 @@
|
||||
module ProductsHelper
|
||||
|
||||
def product_ad(product, options = {}, &block)
|
||||
icon_size = options.delete(:icon) || 24
|
||||
|
||||
options[:class] = ["product-ad", "icon-#{icon_size}", options[:class]].compact.join(" ")
|
||||
options[:onclick] = "location.href = '#{product_path(product)}'"
|
||||
|
||||
content = capture(&block)
|
||||
content = "#{icon(product, icon_size)}#{content}"
|
||||
|
||||
concat content_tag(:div, content, options)
|
||||
end
|
||||
|
||||
def versions_for_select(releases, since = nil)
|
||||
options_for_select(releases.map{|r| r.version if r.has_changelog? && !r.version.include?('Beta') }.compact, since)
|
||||
end
|
||||
|
||||
def download_link_trial_or_free(product)
|
||||
if product.free? || better_splitbutton?
|
||||
download_link(product, "standard-free")
|
||||
else
|
||||
download_link(product, "standard", t('txt.home.free_download'))
|
||||
end
|
||||
end
|
||||
|
||||
def better_slitbutton_buy_link
|
||||
link_to "Buy commercial license with source code from $67", Settings.better_splitbutton_buy_url, :class => "commercial-buy image-link"
|
||||
end
|
||||
|
||||
def better_splitbutton?
|
||||
@product && @product.code == 'better-splitbutton'
|
||||
end
|
||||
|
||||
end
|
||||
2
app/helpers/releases_helper.rb
Normal file
2
app/helpers/releases_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
module ReleasesHelper
|
||||
end
|
||||
2
app/helpers/resources_helper.rb
Normal file
2
app/helpers/resources_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
module ResourcesHelper
|
||||
end
|
||||
11
app/helpers/sitemap_helper.rb
Normal file
11
app/helpers/sitemap_helper.rb
Normal file
@@ -0,0 +1,11 @@
|
||||
module SitemapHelper
|
||||
|
||||
def link(path, default_title)
|
||||
custom_title = @custom_titles.select {|a| a.path == path }.last
|
||||
if custom_title
|
||||
link_to(custom_title.title, path)
|
||||
else
|
||||
link_to(default_title, path)
|
||||
end
|
||||
end
|
||||
end
|
||||
2
app/helpers/subscriptions_helper.rb
Normal file
2
app/helpers/subscriptions_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
module SubscriptionsHelper
|
||||
end
|
||||
2
app/helpers/support_helper.rb
Normal file
2
app/helpers/support_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
module SupportHelper
|
||||
end
|
||||
2
app/helpers/support_requests_helper.rb
Normal file
2
app/helpers/support_requests_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
module SupportRequestsHelper
|
||||
end
|
||||
10
app/helpers/uninstall_helper.rb
Normal file
10
app/helpers/uninstall_helper.rb
Normal file
@@ -0,0 +1,10 @@
|
||||
module UninstallHelper
|
||||
|
||||
#buga> tohle by melo byt jen docasne reseni (vysoce nekonzistentni)
|
||||
def uninstall_issues(product)
|
||||
stdl_issues = ['no-phone-sync', 'no-outlook-sync']
|
||||
issues = UninstallIssue.all
|
||||
issues = issues.delete_if {|r| stdl_issues.include?(r.code) } unless product.is_featured?
|
||||
issues.map {|r| [r.display_name, r.id] }
|
||||
end
|
||||
end
|
||||
78
app/helpers/upgrade_helper.rb
Normal file
78
app/helpers/upgrade_helper.rb
Normal file
@@ -0,0 +1,78 @@
|
||||
module UpgradeHelper
|
||||
|
||||
def pro?
|
||||
!params[:pro].nil?
|
||||
end
|
||||
|
||||
class SurveyFormBuilder < ActionView::Helpers::FormBuilder
|
||||
|
||||
def question(text)
|
||||
inc_questions
|
||||
@template.content_tag(:label, text) + @template.hidden_field_tag(tag_name("question"), text)
|
||||
end
|
||||
|
||||
def answer(type, *args)
|
||||
options = args.extract_options!
|
||||
value = options.delete(:value) || ""
|
||||
|
||||
content = []
|
||||
|
||||
case type
|
||||
when :text_field
|
||||
add_default_name_and_id(options)
|
||||
content << @template.text_field_tag(options.delete(:name), value, options)
|
||||
when :text_area
|
||||
add_default_name_and_id(options)
|
||||
content << @template.text_area_tag(options.delete(:name), value, options)
|
||||
when :check_box
|
||||
[args.first].flatten.each do |value|
|
||||
add_default_name_and_id_for_value(value, options)
|
||||
content << [@template.check_box_tag(options.delete(:name), value, false, options), @template.label_tag(options[:id], value)].join(" ")
|
||||
end
|
||||
when :radio_button
|
||||
[args.first].flatten.each do |value|
|
||||
add_default_name_and_id_for_value(value, options)
|
||||
content << [@template.radio_button_tag(options.delete(:name), value, false, options), @template.label_tag(options[:id], value)].join(" ")
|
||||
end
|
||||
when :select, :combo
|
||||
add_default_name_and_id(options)
|
||||
options[:class] = [options[:class], "combo"].compact.join(" ") if type == :combo
|
||||
content << @template.select_tag(options.delete(:name), @template.options_for_select(args.first, options.delete(:selected)), options)
|
||||
when :combo
|
||||
|
||||
end
|
||||
|
||||
content.join("")
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def add_default_name_and_id(options)
|
||||
options[:name] = tag_name("answer", :multiple => true)
|
||||
options[:id] = tag_id("answer")
|
||||
end
|
||||
|
||||
def add_default_name_and_id_for_value(value, options)
|
||||
pretty_tag_value = value.to_s.gsub(/\s/, "_").gsub(/\W/, "").downcase
|
||||
add_default_name_and_id(options)
|
||||
options[:id] += "_#{pretty_tag_value}"
|
||||
end
|
||||
|
||||
def tag_name(type, options = {})
|
||||
"#{@object_name}[survey][#{@questions}][#{type}]" + (options.has_key?(:multiple) ? '[]' : '')
|
||||
end
|
||||
|
||||
def tag_id(type, value = nil)
|
||||
"#{@object_name}_survey_#{@questions}_#{type}"
|
||||
end
|
||||
|
||||
def inc_questions
|
||||
if @questions
|
||||
@questions = @questions + 1
|
||||
else
|
||||
@questions = 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
2
app/helpers/wp_helper.rb
Normal file
2
app/helpers/wp_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
module WpHelper
|
||||
end
|
||||
Reference in New Issue
Block a user