This is my first week of Ruby and ROR and new to this discussiongroup.
I build a pdf generator with prawn. Currently I run it from a run.rb file
that contains:
PDFGenerator::A5.new(filename: "a5.pdf",>
> colors: {
> instructions: "525149",
> instructions_header: "000000",
> panel: "001430",
> experience: "FFFFFF",
> qr_reader: "525149"
> },
> texts: {
> qr_code_instructions: "*Some instructions ",
> instructions_header: "Some header",
> instructions: "Some instructions ",
> link: "www.someurl.com",
> experience_header: "Some header",
> experience: "Some text"
> },
> photo: "images/img.jpg",
> qr_code: "http://img.from.url",
> logo: "images/logo.png").generate
>
> Now I have no idea, how to execute that file when I press on my generate
button in my rails app:
<%= form_for @assemble do |f| %>> <div class="row">
> <div class="span2">
> <h2 style="text-align: right;">Your</h2>
> <ul id="download_ul">
> <li style="margin-top: 5px;"><%= f.label
:title_top %> </li>
> <li style="margin-top: 13px;"><%= f.label
:text_top %></li>
> <li style="margin-top: 13px;"><%= f.label
:link %></li>
> <li style="margin-top: 13px;"><%= f.label
:title_bottom %></li>
> <li style="margin-top: 13px;"><%= f.label
:text_bottom %></li>
> <li style="margin-top: 13px;"><%= f.label
:qr_code_url %></li>
> <li style="margin-top: 13px;"><%= f.label
:photo %></li>
> <li style="margin-top: 13px;"><%= f.label
:logo %></li>
> <li style="margin-top: 10px;"><%= f.label
:format %></li>
> <li style="margin-top: 0px;"><%= f.label
:cut_lines %></li>
> </ul>
> </div>
> <div class="span3">
> <h2>Information</h2>
> <form method="post" action="run.rb">
> <ul class="download_ul">
> <li><%= f.text_field :title_top %></li>
> <li><%= f.text_field :text_top%></li>
> <li><%= f.text_field :link%></li>
> <li><%= f.text_field :title_bottom %></li>
> <li><%= f.text_field :text_bottom %></li>
> <li><%= f.text_field :qr_code_url %></li>
> <li><%= f.text_field :photo %></li>
> <li><%= f.text_field :logo %></li>
> <li style="margin-top: 6px;">
> A4<%= f.check_box :format_a4 %>
> A5<%= f.check_box :format_a5 %>
> Letter<%= f.check_box :format_letter %>
> Business card<%= f.check_box :format_business_card %>
> </li>
> <li style="margin-top: 6px;">
> True<%= f.check_box :cut_lines_true %>
> False<%= f.check_box :cut_lines_false %>
> </li>
> </ul>
> <p><input type="submit"
class="btn" value="Assemble
> »"></p>
> </form>
> </div>
> <div class="span6">
> <h2>Example</h2>
> <p><%= image_tag("a5.png", :size =>
"420x600") %></p>
> </div>
> </div>
> <% end %>
> </div>
I have my files in the appropriate places. But I just don''t ahead from
this.
Model: assemble.rb:
> class Assemble < ActiveRecord::Base
> # attr_accessible :title, :body
> end
Controller: assemble_controller:
class AssembleController < ApplicationController
def index
redirect_to new_assemble_path
end
def new
@assemble = Assemble.new
end
end
My apologies if this is the wrong place to ask my question, but I have been
lost at this for 2 days now and I don''t know how to find the answer on
Google :/
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit
https://groups.google.com/d/msg/rubyonrails-talk/-/BNMm_9fizYsJ.
For more options, visit https://groups.google.com/groups/opt_out.