Permalink
Browse files

show item view

  • Loading branch information...
1 parent 594a43f commit a4cb3747666b8e2d748b89cb7254b26513052053 @gakshay committed Mar 11, 2011
Showing with 24 additions and 12 deletions.
  1. +1 −1 app/controllers/stamps_controller.rb
  2. +16 −9 app/views/stamps/_show_item.html.erb
  3. +7 −2 public/javascripts/application.js
@@ -15,7 +15,7 @@ def index
# GET /stamps/1.xml
def show
@stamp = current_user.stamps.find(params[:id])
-
+ @css = @stamp.setting.settings
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @stamp }
@@ -1,18 +1,18 @@
-<div id="vsign_wrapper" class="vsign_wrapper">
- <div class="vsign_top">
+<div id="vsign_wrapper_<%= @stamp.id %>" class="vsign_wrapper" style="position: relative;">
+ <div class="vsign_top_<%= @stamp.id %>">
</div>
- <div id="vsign_content" class="vsign_content absolute">
+ <div id="vsign_content_<%= @stamp.id %>" class="vsign_content absolute" data-css="<%= @stamp.setting.settings['stamp_content'] %>">
- <div id="vsign_name" class="vsign_name ten"><%= @stamp.name.blank? ? "Enter full name" : @stamp.name%></div>
+ <div id="vsign_name_<%= @stamp.id %>" class="vsign_name ten absolute" data-css="<%= @stamp.setting.settings['stamp_name'] %>"><%= @stamp.name.blank? ? "Enter full name" : @stamp.name%></div>
<br>
- <div id="vsign_email" class="vsign_email absolute">
+ <div id="vsign_email_<%= @stamp.id %>" class="vsign_email absolute" data-css="<%= @stamp.setting.settings['stamp_email'] %>">
<%= current_user.email%>
</div>
<br>
- <div id="vsign_mobile" class="vsign_name absolute ten"><%= @stamp.mobile.blank? ? "Enter mobile number" : @stamp.mobile %></div>
+ <div id="vsign_mobile_<%= @stamp.id %>" class="vsign_name absolute ten" data-css="<%= @stamp.setting.settings['stamp_mobile'] %>"><%= @stamp.mobile.blank? ? "Enter mobile number" : @stamp.mobile %></div>
<br>
- <div id="vsign_links" class="vsign_links">
+ <div id="vsign_links_<%= @stamp.id %>" class="vsign_links">
</div>
<div class="vsign_powered absolute" style="bottom: -15px; ">
@@ -24,7 +24,14 @@
<div class="clear"></div>
- <div class="vsign_bottom">
+ <div class="vsign_bottom_<%= @stamp.id %>">
</div>
-</div>
+</div>
+
+<script type="text/javascript" charset="utf-8">
+ showElementPosition($("#vsign_content_<%= @stamp.id %>"));
+ showElementPosition($("#vsign_name_<%= @stamp.id %>"));
+ showElementPosition($("#vsign_email_<%= @stamp.id %>"));
+ showElementPosition($("#vsign_mobile_<%= @stamp.id %>"));
+</script>
@@ -19,13 +19,13 @@ $(function() {
//console.log(ui.helper.data());
},
create: function(event, ui){
- var content = $(".vsign_content");
+ var content = $("#vsign_content");
var content_settings = jQuery.parseJSON($("#settings_stamp_content").val());
if (content && content_settings){
placeElement(content, content_settings)
}
- var email = $(".vsign_email");
+ var email = $("#vsign_email");
var email_settings = jQuery.parseJSON($("#settings_stamp_email").val());
if (email && email_settings){
placeElement(email, email_settings)
@@ -95,6 +95,7 @@ function setCssSize(element){
}
function placeElement(element, settings){
+ console.log(element);
element.css(settings.position);
element.css(settings.size);
setDataPosition(element, settings.position);
@@ -103,3 +104,7 @@ function placeElement(element, settings){
setCssSize(element);
}
+function showElementPosition(element){
+ placeElement(element, element.data("css"));
+}
+

0 comments on commit a4cb374

Please sign in to comment.