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 Formtastic #:nodoc: | |
module Inputs #:nodoc: | |
class EnumInput < SelectInput #:nodoc: | |
def to_html | |
unless options[:collection] | |
enum = @object.enums(method.to_sym) | |
choices = enum ? enum.select_options : [] | |
options[:collection] = choices | |
end | |
if (value = @object.__send__(method.to_sym)) |
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 AddInvoiceDateToContrat < ActiveRecord::Migration | |
def change | |
add_column :contrats, :invoice_date, :date | |
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
# encoding: utf-8 | |
class Invoice < Prawn::Document | |
def to_pdf(contrat) | |
text "BON DE COMMANDE #{contrat.order_number}", :align=>:center, :size=>17 | |
move_down 16 | |
text "Date :",:size=>12 | |
bounding_box([0, 620], :width => 250, :height => 80) do | |
bounding_box([3, 80], :width => 247, :height => 80) do | |
move_down 21 | |
text "" |
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
ActionView::Template::Error (backend.css isn't precompiled): | |
1: <!DOCTYPE html> | |
2: <html> | |
3: <head> | |
4: <%= stylesheet_link_tag "backend", :media => "all" %> | |
5: <%= javascript_include_tag "backend" %> | |
6: <%= csrf_meta_tags %> | |
7: </head> | |
app/views/layouts/backend/application.html.erb:4:in `_app_views_layouts_backend_application_html_erb__239998381177855 7849_34715260' |
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
<%= semantic_form_for pricing,:url => url_for(:controller =>"backend/discounts", | |
:action =>"update"),:method=>:put do |p| %> | |
<%= p.inputs :for => :discounts do |f| %> | |
<tr> | |
<td><%=f.input :price,:label=>false%></td> | |
<td><%=f.input :subscription,:label=>false %></td> | |
<td><%=f.input :commission_fixed,:label=>false %></td> | |
<td><%=f.input :commission_percentage,:label=>false %></td> | |
<td><%=f.input :per_room,:label=>false %></td> | |
<td> |
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
<%= semantic_nested_form_for pricing do |p| %> | |
<%= p.input :id, :as => :hidden %> | |
<%= p.inputs :for => :discounts do |f| %> | |
.... all the fields of the nested element | |
<%= f.link_to_remove "Supprimer cette remise" %> | |
<% end %> | |
<%= p.link_to_add "Ajouter une remise", :discounts %> | |
<%= p.actions do %> | |
<%= p.action :submit, :label=>"Créer la remise"%> |
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
factory :user do | |
email { Faker::Internet.email} | |
#Lots of declarations | |
#.... | |
adresse | |
factory :user_with_recurring_order_to_generate do | |
after(:build) do |u| | |
u.contrats << build(:contrat_with_active_product) | |
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
require 'fileutils' | |
desc "Create nondigest versions of all ckeditor digest assets" | |
task "assets:precompile" do | |
fingerprint = /\-[0-9a-f]{32}\./ | |
for file in Dir["public/assets/ckeditor/**/*"] | |
next unless file =~ fingerprint | |
nondigest = file.sub fingerprint, '.' | |
FileUtils.cp file, nondigest, verbose: true | |
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
require 'active_support/concern' | |
module Rankable | |
extend ActiveSupport::Concern | |
included do | |
validates :row_order, :presence => true | |
scope :next_rank, lambda { |rank| where('row_order > ?',rank).order("row_order asc").limit(1)} | |
scope :previous_rank, lambda { |rank| where('row_order < ?',rank).order("row_order desc").limit(1)} | |
scope :bigger_rank, order("row_order desc") | |
before_validation :assign_default_rank |
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
= nested_form_for [ :admin, @gallery ],:html => { :multipart => true } do |f| | |
.large-12.columns | |
=f.text_field :title, as: :string | |
= f.fields_for :gal_images do |gi| | |
.large-12.columns | |
= gi.text_field :title, as: :string | |
= gi.file_field :image | |
= gi.cktext_area :comment, as: :ckeditor | |
= gi.text_field :alt, :label => "contenu du alt" | |
= image_tag gi.object.image.url(:icone) |
OlderNewer