forked from publify/publify
-
Notifications
You must be signed in to change notification settings - Fork 0
/
_form.html.erb
162 lines (151 loc) · 7.49 KB
/
_form.html.erb
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
<%= hidden_field_tag "user_textfilter", current_user.text_filter_name %>
<div id="autosave"><%= hidden_field_tag("article[id]", @article.id) if @article.present? %></div>
<div id="article_keywords_auto_complete" class="auto_complete"></div>
<h2 class='page-header'>
<i class='icon-large icon-article-new'></i>
<%= _("#{controller.action_name.to_s.capitalize} article") %>
<span class='pull-right'>
<span id='preview_link'>
<%= link_to(t(".preview"), {controller: '/articles', action: 'preview', id: @article.id}, {target: 'new', class: 'btn'}) if @article.id %>
</span>
<input id='save_draft' type="submit" value="<%= t('.save_as_draft') %>" name="article[draft]" class='btn' />
<%= submit_tag(t(".publish"), :class => 'btn btn-primary') %>
</span>
</h2>
<%= error_messages_for 'article' %>
<div>
<div>
<div>
<div class='span9'>
<div>
<%= text_field 'article', 'title', :class => 'input-block-level', :placeholder => t('.title') %>
</div>
<%= render('images', { :images => @images}) unless @images.empty? %>
<div id="editor">
<i class='icon icon-media'></i> <span id='image-link'>
<a href="#" onclick="Element.toggle('carousel-wrapper'); return false"><%= t('.images')%></a>
</span>
<div id='quicktags'>
<script type="text/javascript">edToolbar('article_body_and_extended', '<%= @article.text_filter %>');</script>
</div>
<div id='simple_editor'>
<%= text_area('article', 'body_and_extended', {:class => 'input-block-level', :height => '360px'}) %>
<%= render 'admin/shared/macros' %>
</div>
</div>
<div class='separator'>
<h4><%= t(".excerpt") %></h4>
<%= text_area 'article', 'excerpt', {:height => '150', :class => 'input-block-level', :rows => '5'} %>
<span class='help-block'><%=t(".excerpt_explaination") %></span>
</div>
<div class='well'>
<fieldset>
<legend><%= t(".publish_settings") %></legend>
<div class='control-group'>
<p><%= t(".status") %>: <strong><%= _(@article.state.to_s.downcase) %></strong>
<a href="#" onclick="Element.toggle('status'); return false"><%= t('.change')%></a>
</p>
<div id='status' style='display: none;'>
<label for="article_published" class='checkbox'>
<%= check_box 'article', 'published' %>
<%= t(".published") %>
</label>
<p><span class='btn btn-mini'>
<a href="#" onclick="Element.toggle('status'); return false">OK</a>
</span></p>
</div>
</div>
<div class='control-group'>
<p><%= t(".allowed_comments_and_trackbacks", allow_comment: content_tag(:strong, get_feedback_status(@article.allow_comments)), allow_trackback: content_tag(:strong, get_feedback_status(@article.allow_pings))) %>
<a href="#" onclick="Element.toggle('conversation'); return false"><%= t('.change')%></a>
<div id='conversation' style='display: none'>
<label for="article_allow_pings" class='checkbox'>
<%= check_box 'article', 'allow_pings' %>
<%= t(".allow_trackbacks") %>
</label>
<label for="article_allow_comments" class='checkbox'>
<%= check_box 'article', 'allow_comments' %>
<%= t(".allow_comments") %>
</label>
<p><span class='btn btn-mini'>
<a href="#" onclick="Element.toggle('conversation'); return false"><%= t('.ok')%></a>
</span></p>
</div>
</div>
<div class='control-group'>
<p><%= t(".published") %> <strong><%= publish_now_or_already_published @article %></strong>
<a href="#" onclick="Element.toggle('publish'); return false"><%= t('.change')%></a>
</p>
<div id='publish' class='input-append' style='display: none;'>
<%= calendar_date_select 'article', 'published_at' %>
<p><span class="btn btn-mini">
<a href="#" onclick="Element.toggle('status'); return false"><%= t('.ok')%></a>
</span></p>
</div>
</div>
<div class='control-group'>
<p><%= t(".visibility") %>: <strong><%= @article.password.nil? || @article.password.empty? ? t(".public") : t(".protected") %></strong>
<a href="#" onclick="Element.toggle('visibility'); return false"><%= t('.change')%></a>
</p>
<div id='visibility' style='display: none'>
<label for="article_password"><%= t(".password") %>
<%= password_field :article, :password, :class => 'span10' %>
</label>
<p><span class="btn btn-mini">
<a href="#" onclick="Element.toggle('status'); return false"><%= t('.ok')%></a>
</span></p>
</div>
</div>
<div class='control-group'>
<%= t(".permalink") %>:
<a href="#" onclick="Element.toggle('permalink'); return false"><%= t('.change')%></a>
<div class='inputs-list' id='permalink' style='display: none'>
<%= text_field 'article', 'permalink', {class: 'span10'} %>
<p><span class="btn btn-mini">
<a href="#" onclick="Element.toggle('status'); return false"><%= t('.ok')%></a>
</span></p>
</div>
</div>
<div class='control-group'>
<%= t(".article_filter") %>: <strong id='text_filter_placeholder'><%= _("#{@article.text_filter.description}") %></strong>
<a href="#" onclick="Element.toggle('text_filter'); return false"><%= t('.change')%></a>
<div id='text_filter' style='display: none'>
<select name="article[text_filter]" id="article_text_filter">
<%= options_for_select text_filter_options, @article.text_filter %>
</select>
<p><span class="btn btn-mini">
<a href="#" onclick="Element.toggle('status'); return false"><%= t('.ok')%></a>
</span></p>
</div>
</div>
</fieldset>
</div>
<div class='form-actions'>
<div class='pull-right'>
<%- if @article.id.present? && @article.state.to_s.downcase != 'draft' %>
<%- if current_user.admin? || current_user.id == @article.user_id %>
<%= link_to(t(".delete"), { action: 'destroy', id: @article.id }, data: {confirm: t(".are_you_sure")}, method: :post, class: 'btn danger', title: t(".delete_content")) %>
<%- end %>
<%- end %>
<span id='destroy_link'><%= link_to_destroy_draft @article %></span>
<input id='save_draft' type="submit" value="<%= t('.save_as_draft') %>" name="article[draft]" class='btn info' />
<%= submit_tag(t(".publish"), :class => 'btn btn-primary') %>
</div>
</div>
</div>
</div>
<div class='span3'>
<div class='well'>
<h4><%= t(".categories") %></h4>
<%= render 'categories' %>
</div>
<div class='well'>
<h4><%= t(".tags") %></h4>
<div class='class'>
<%= text_field 'article', 'keywords', {:autocomplete => 'off', :class => 'input-block-level'} %>
<p class='alert alert-warning'><%=t(".tags_explaination") %></p>
</div>
<%= auto_complete_field 'article_keywords', { :url => { :action => "auto_complete_for_article_keywords"}, :method => 'get', :tokens => ','}%>
</div>
<%= get_post_types %>
</div>