now supporting recruit module

This commit is contained in:
Harry Bomrah 2018-01-25 17:24:39 +08:00
parent c0d88f0f93
commit 79f5bf991d
4 changed files with 29 additions and 1 deletions

View File

@ -33,6 +33,7 @@ class ArchivesController < ApplicationController
end end
{ {
"archive-title" => archive.title, "archive-title" => archive.title,
"url" => archive.url,
"statuses" => statuses, "statuses" => statuses,
"sort_number" => archive.sort_number, "sort_number" => archive.sort_number,
"is_top" => (archive.is_top ? 1 : 0), "is_top" => (archive.is_top ? 1 : 0),

View File

@ -18,6 +18,7 @@ class ArchiveFile
field :title, as: :slug_title, localize: true field :title, as: :slug_title, localize: true
field :url, localize: true
field :create_user_id field :create_user_id
field :update_user_id field :update_user_id
field :postdate , :type => DateTime, :default => Time.now field :postdate , :type => DateTime, :default => Time.now
@ -39,6 +40,22 @@ class ArchiveFile
after_save :save_archive_file_multiples after_save :save_archive_file_multiples
before_save :add_http
protected
def add_http
temp_url = {}
Site.first.in_use_locales.each do |locale|
locale = locale.to_s
temp_url[locale] = self.url_translations[locale]
unless /https?:\/\/[\S]+/.match(self.url_translations[locale]) || self.url_translations[locale].blank?
temp_url[locale] = 'http://' + self.url_translations[locale]
end
end
self.url_translations = temp_url
end
# def to_indexed_json # def to_indexed_json
# self.to_json # self.to_json
# end # end

View File

@ -121,6 +121,16 @@
<% end %> <% end %>
</div> </div>
</div> </div>
<!-- url -->
<div class="control-group input-title">
<label class="control-label muted"><%= t(:url) %></label>
<div class="controls">
<%= f.fields_for :url_translations do |f| %>
<%= f.text_field locale, class: "input-block-level", placeholder: t(:url), value: (@archive_file.url_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
</div> </div>

View File

@ -30,7 +30,7 @@
<ul class="nav nav-pills"> <ul class="nav nav-pills">
<% if can_edit_or_delete?(archive) %> <% if can_edit_or_delete?(archive) %>
<li><a href="/<%= I18n.locale.to_s %>/admin/archive_files/<%= archive.id.to_s %>/edit"><%= t(:edit) %></a></li> <li><a href="/<%= I18n.locale.to_s %>/admin/archive_files/<%= archive.id.to_s %>/edit"><%= t(:edit) %></a></li>
<li><a href="/admin/archive_files/<%= archive.id.to_s %>" data-method="delete" data-confirm="Are you sure?"><%= t(:delete_) %></a></li> <li><a href="/admin/archive_files/<%= archive.id.to_s %>" class="delete text-error" data-method="delete" data-confirm="Are you sure?"><%= t(:delete_) %></a></li>
<% end %> <% end %>
</ul> </ul>
</div> </div>