forked from bborn/communityengine
/
new_clipping.html.haml
123 lines (108 loc) · 4.43 KB
/
new_clipping.html.haml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
%html
%head
%title
= AppConfig.community_name
\- New Clipping
= render :partial => '/shared/scripts_and_styles'
= javascript_include_tag 'lightbox', :plugin => "community_engine"
= stylesheet_link_tag 'lightbox', :plugin => "community_engine"
%style{"type"=>"text/css"}
:plain
body {
font: 1em "Lucida Grande", "Trebuchet MS", Verdana, sans-serif;
background: none;
}
ul#clipping_image_list {
list-style:none;
padding:none;
width: 400px;
height: 400px;
overflow: auto;
}
ul#clipping_image_list li {
display:inline;
margin:1em;
}
ul#clipping_image_list li img {
cursor:pointer;
cursor: hand;
padding:3px;
border:1px solid #ccc;
width: 200px;
}
div#form_div {
width:550px;
padding:10px;
}
%body
#doc3
#bd
.yui-g
.yui-u.first.box
%h3 Create a clipping
%ul#clipping_image_list
= image_tag 'spinner.gif', :plugin => "community_engine"
Loading images
%script{"type"=>"text/javascript"}
= remote_function(:url => { :action => "load_images_from_uri", :params => {:uri => params[:uri]} } )
%small
%a{"href"=>"#{ params[:uri] }"}
Cancel, and go back to
= @clipping.url
#form_div{"style"=>"display:none;"}
- form_for(:clipping, :url => user_clippings_path(@user), :html => {:class => "MainForm"} ) do |f|
%label Url
= f.text_field :url
%img#clipping_preview{"src"=>nil, "width"=>"175px", "style"=>"float:right"}
%label Image url
= f.text_field :image_url
%label Tags
= text_field_tag 'tag_list', @clipping.tags.collect{|t| t.name}.join(", "), {:autocomplete => "off",:id => 'clipping_tag_list'}
#clipping_tag_list_auto_complete.auto_complete
= auto_complete_field 'clipping_tag_list', {:url => {:controller => "tags", :action => 'auto_complete_for_tag_name'}, :tokens => [',', ' '], :update => 'clipping_tag_list_auto_complete' }
%label Description
= f.text_field :description
%p= submit_tag "Create"
%script{"type"=>"text/javascript"}
image_list = $('clipping_image_list')
Event.observe(image_list, 'click', function(e){
element = Event.element(e);
if (element.parentNode.tagName.toLowerCase() == 'li' ){
$('clipping_image_url').value = element.src;
$('clipping_preview').src = element.src;
new Lightbox.base('form_div');
}
return;
});
.yui-u.box
%h3 Create a post
- form_for(:post, :url => user_posts_path(current_user), :html => {:class => "MainForm"}) do |f|
- unless @post.category || @post.contest
%label
="Category".l
\:
%select#post_category_id{"name"=>"post[category_id]", "id"=>"post_category_id"}
- for category in Category.find(:all)
%option{:value => category.id, :selected => category.eql?(Category.get(:talk))}
= h(category.name)
- else
= f.hidden_field :category_id
= f.hidden_field :contest_id
%label
Title
%rm (required)
\:
= f.text_field :title
%label
Body Text
%em (required)
\:
= f.text_area :raw_post, :size => "50x15"
%label
Tags
%em="(optional keywords describing this post, separated by spaces)"
\:
= text_field_tag 'tag_list', @post.tags.collect{|t| t.name}.join(", "), {:autocomplete => "off", :size => 35, :id => 'post_tag_list'}
#post_tag_list_auto_complete.auto_complete
= auto_complete_field 'post_tag_list', {:url => { :controller => "tags", :action => 'auto_complete_for_tag_name'}, :tokens => [',', ' '], :update=> 'post_tag_list_auto_complete' }
%p= submit_tag "Save"