Merge branch 'design_team' into ldap

Conflicts:
	app/views/devise/sessions/new.html.erb
	vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/fact_checks/_privilege_user.html.erb
This commit is contained in:
Christophe Vilayphiou 2012-04-25 16:45:04 +08:00
commit 1f4fe65430
18 changed files with 142 additions and 238 deletions

View File

@ -7,9 +7,7 @@ $(document).ready(function() {
$(this).after("<span id='show_preview'></span>"); $(this).after("<span id='show_preview'></span>");
$.ajax({ $.ajax({
type: 'PUT', type: 'PUT',
//async : true,
url:$(this).attr("href"), url:$(this).attr("href"),
contentType: 'application/javascript; charset=utf-8',
data:$(this).parents("form").serialize(), data:$(this).parents("form").serialize(),
success: function (msg) { success: function (msg) {
$("#"+start_modal_with_id).modal('show'); }, $("#"+start_modal_with_id).modal('show'); },

View File

@ -35,6 +35,9 @@
width: 350px; width: 350px;
left: -8px; left: -8px;
} }
.main-list tr:first-child td {
border-top: 1px solid #DDDDDD;
}
.main-list td { .main-list td {
background-color: #FFFFFF; background-color: #FFFFFF;
border-bottom: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD;
@ -75,6 +78,9 @@
-moz-border-radius: 3px; -moz-border-radius: 3px;
z-index: 5; z-index: 5;
} }
.qe-edit-div .table-condensed {
background-color: #F2F2F2;
}
.table-label { .table-label {
background-color: #F2F2F2; background-color: #F2F2F2;
position: relative; position: relative;
@ -94,6 +100,18 @@
height:auto; height:auto;
padding: 0; padding: 0;
} }
.qe-block legend {
padding-left: 8px;
margin-bottom: 0;
padding-bottom: 0;
}
.qe-block .control-group {
margin-bottom: 0;
}
.qe-block .controls, .qe-block .control-label {
margin-top: 10px;
margin-bottom: 10px;
}
.qe-block .table td, .qe-block .table th { .qe-block .table td, .qe-block .table th {
padding: 8px; padding: 8px;
} }

View File

@ -613,8 +613,15 @@
.text-green { .text-green {
color: #39b54a !important; color: #39b54a !important;
} }
.adbanner-setup {
margin-right: 10px;
margin-bottom: 30px !important;
}
.adbanner-list { .adbanner-list {
margin-top: 20px; border-top: 1px solid #AAA;
margin-right: 10px;
padding-top: 10px;
position: relative;
} }
.adbanner-list ul { .adbanner-list ul {
margin: 0px; margin: 0px;
@ -625,7 +632,12 @@
margin-right: 20px; margin-right: 20px;
} }
.adbanner-action { .adbanner-action {
margin-bottom: 20px; position: absolute;
top: -32px;
right: 0;
}
#bulletin_link_qe form {
margin: 0;
} }
[class^="icons-"] { [class^="icons-"] {
display: inline-block; display: inline-block;

View File

@ -101,6 +101,18 @@
.file-upload .upload:focus { .file-upload .upload:focus {
position:absolute; position:absolute;
} }
.file-upload .input-medium {
border-radius: 3px 3px 3px 3px !important;
width: 267px;
position: relative;
z-index: 5;
display: block;
clear: both;
}
.file-upload .control-label {
margin-top: 0;
margin-bottom: 5px;
}
.upload-picture { .upload-picture {
margin-bottom: 5px; margin-bottom: 5px;
text-align: center; text-align: center;
@ -120,12 +132,6 @@
margin : 0px 0 5px; margin : 0px 0 5px;
padding: 5px 10px; padding: 5px 10px;
} }
.file-upload .input-medium {
border-radius: 3px 3px 3px 3px !important;
width: 267px;
position: relative;
z-index: 5;
}
#widget-link table { #widget-link table {
margin-bottom:0 margin-bottom:0
} }

View File

@ -45,8 +45,8 @@ class Admin::AdBannersController < ApplicationController
end end
def realtime_preview def realtime_preview
@ad_banner = AdBanner.first(conditions: { title: params[:title] }).preview_clone @ad_banner = AdBanner.find( params[:id] ).preview_clone
#@ad_banner.update_attributes(params[:ad_banner]).update_attributes(params[:ad_images]) @ad_banner.update_attributes(params[:ad_banner])#.update_attributes(params[:ad_images])
end end
def index def index

View File

@ -1,15 +1,19 @@
<div class="tab-pane <%= "active" if ad_banner_tab==@active%>" id=<%= ad_banner_tab.title %>> <div class="tab-pane fade <%= "active in" if ad_banner_tab==@active%>" id=<%= ad_banner_tab.title %>>
<p><%= t("admin.ad.banner_best_size") %></p>
<%= form_for ad_banner_tab,:url=> admin_ad_banner_path(ad_banner_tab),:method => :put,:class=>"input-medium" do |f| -%> <%= form_for ad_banner_tab,:url=> admin_ad_banner_path(ad_banner_tab),:method => :put,:class=>"input-medium" do |f| -%>
<div class="adbanner-setup well">
<!--<p><%#= t("admin.ad.banner_best_size") %></p>-->
<%= f.label :ad_fx, t('admin.ad.ab_fx') %> <%= f.label :ad_fx, t('admin.ad.ab_fx') %>
<%= f.select :ad_fx ,AdBanner::FX_TYPES %> <%= f.select :ad_fx ,AdBanner::FX_TYPES %>
<%= f.label :transition_sec, t('admin.ad.transition_sec') %> <%= f.label :transition_sec, t('admin.ad.transition_sec') %>
<%= f.text_field :transition_sec,:placeholder=>t('admin.ad.sec_place_holder'),:class=> "span3" %> <%= t("admin.ad.trans_unit_sec") %> <%= f.text_field :transition_sec,:placeholder=>t('admin.ad.sec_place_holder'),:class=> "span3" %> <%= t("admin.ad.trans_unit_sec") %>
<%= f.submit t("admin.ad.update_banner") %> <br>
<%= f.submit t("cancel"),:type=>'reset' %> <%= f.submit t("admin.ad.update_banner"), :class => 'btn' %>
<%= f.submit t("cancel"),:type=>'reset', :class => 'btn' %>
</div>
<h3>圖片列表</h3>
<div class="adbanner-list"> <div class="adbanner-list">
<div class="adbanner-action"> <div class="adbanner-action pagination-right">
<%= link_to t("admin.ad.new_image"),new_admin_ad_banner_ad_image_path(ad_banner_tab) ,:class => "btn btn-primary"%> <%= link_to t("admin.ad.new_image"),new_admin_ad_banner_ad_image_path(ad_banner_tab) ,:class => "btn btn-primary"%>
<%= link_to t("modal.preview"), admin_realtime_preview_ad_banner_path(ad_banner_tab.title) , :class=>'preview_trigger btn btn-success'%> <%= link_to t("modal.preview"), admin_realtime_preview_ad_banner_path(ad_banner_tab.title) , :class=>'preview_trigger btn btn-success'%>
</div> </div>

View File

@ -1,6 +1,6 @@
<% if ad_banner -%> <% if ad_banner -%>
<div class="modal hide fade in banner-preview" id='slideshow-<%=ad_banner.title.dehumanize%>'> <div class="modal hide fade in banner-preview" id="slideshow-<%=ad_banner.title.dehumanize%>">
<div class="modal-header"> <div class="modal-header">
<a class="close" data-dismiss="modal">×</a> <a class="close" data-dismiss="modal">×</a>
<h3><%= t("modal.preview") %></h3> <h3><%= t("modal.preview") %></h3>
@ -8,28 +8,29 @@
<div class="modal-body"> <div class="modal-body">
<p class="ad_banner_slideshow"> <p class="ad_banner_slideshow">
<% preview_block_ad_images_helper(ad_banner).each do |ad_image| -%> <% preview_block_ad_images_helper(ad_banner).each do |ad_image| -%>
<%= image_tag ad_image.file,:alt => (ad_image.title[locale] || ' '),:time_to_next => ad_banner.transition_sec,:link_open=> ad_image.link_open, :link_url =>((ad_image.out_link || ad_banner.context || ' ')) %> <%= image_tag ad_image.file,:alt => (ad_image.title[locale] || " "),:time_to_next => ad_banner.transition_sec,:link_open=> ad_image.link_open, :link_url =>((ad_image.out_link || ad_banner.context || " ")) %>
<% end -%> <% end -%>
</p> </p>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<a href="#" class="btn" data-dismiss="modal"><%= t("modal.close") %></a> <a href="#" class="btn" data-dismiss="modal"><%= t("modal.close") %></a>
</div> </div>
</div> <div>
<script type="text/javascript" src="/static/kernel.js"></script>
<% end -%> <script type="text/javascript">
<script type='text/javascript' src='/static/kernel.js'></script>
<script type='text/javascript'>
$(document).ready(function() { $(document).ready(function() {
$('#slideshow-<%=ad_banner.title.dehumanize%>').on('show', function () { $("#slideshow-<%=ad_banner.title.dehumanize%>").on("show", function () {
$('#slideshow-banner_1').find(".ad_banner_slideshow").cycle({delay: -1000, fx: '<%= ad_banner.ad_fx.nil?? 'fade': ad_banner.ad_fx %>', timeoutFn: getTimeout }); $("#slideshow-<%=ad_banner.title.dehumanize%>").find(".ad_banner_slideshow").cycle({delay: -1000, fx: "<%= ad_banner.ad_fx.nil?? "fade": ad_banner.ad_fx %>", timeoutFn: getTimeout });
}); });
$(".modal").on('hidden', function () { $(".modal").on("hidden", function () {
$("#show_preview").remove(); $("#show_preview").remove();
}); });
//$('#slideshow-<%=ad_banner.title.dehumanize%>').show();
}); });
</script> </script>
</div>
</div>
<% end -%>

View File

@ -83,7 +83,7 @@
<span class="alert widgetInfo">此區塊圖片尺寸請使用580px × 225px</span> <span class="alert widgetInfo">此區塊圖片尺寸請使用580px × 225px</span>
<div class="controls file-upload input-prepend"> <div class="controls file-upload input-prepend">
<label class="control-label add-on btn" for="input-upload"> <label class="control-label add-on btn" for="input-upload">
Choose file <%= t(:browse) %>
<%= f.file_field :file,:id=>"input-upload",:class => "upload", :onchange=> "document.getElementById('fu1').innerHTML = this.form.fu1.value = this.value;" %> <%= f.file_field :file,:id=>"input-upload",:class => "upload", :onchange=> "document.getElementById('fu1').innerHTML = this.form.fu1.value = this.value;" %>
</label> </label>
<span id="fu1" class="file-name"></span> <span id="fu1" class="file-name"></span>

View File

@ -5,9 +5,11 @@
<%= flash_messages %> <%= flash_messages %>
<div id="container" class="sign-in"> <div id="container" class="sign-in">
<% flash.each do |key, msg| %>
<%= content_tag :spen, msg, :class => [key, "notice label label-warning"] %>
<% end%>
<%= form_for :user, :url => user_session_path, :html => {:class => 'user_new form-horizontal'} do |f| %> <%= form_for :user, :url => user_session_path, :html => {:class => 'user_new form-horizontal'} do |f| %>
<div class="content"> <div class="content">
<p class="notice label label-warning">Notice</p>
<p class="alert hide">You need to sign in or sign up before continuing.</p> <p class="alert hide">You need to sign in or sign up before continuing.</p>
<div class="main"> <div class="main">
<div class="control-group clear"> <div class="control-group clear">

View File

@ -25,7 +25,7 @@ Orbit::Application.routes.draw do
end end
match 'ad_banner/:title/preview' => 'ad_banners#realtime_preview',:as => :realtime_preview_ad_banner,:via => :put match 'ad_banner/:id/preview' => 'ad_banners#realtime_preview',:as => :realtime_preview_ad_banner,:via => :put
resources :ad_banners do resources :ad_banners do
collection do collection do
match 'new_ad_image' => 'ad_images#new',:as => :new_ad_image,:via => :get match 'new_ad_image' => 'ad_images#new',:as => :new_ad_image,:via => :get

View File

@ -1,75 +0,0 @@
class Panel::Announcement::BackEnd::FactChecksController < OrbitBackendController
before_filter :authenticate_user!
include AdminHelper
# layout 'admin'
def setting
@bulletin_categorys = BulletinCategory.all
if params.has_key?(:category_id)
first_category = BulletinCategory.find params[:category_id]
if params[:commit] == 'Update'
privilege_users = params[:users].collect{|key,value| User.find key } rescue []
preload_object_auth_ary = first_category.object_auths.where(title: 'fact_check') || (first_category.object_auths.create :title=> 'fact_check')
preload_object_auth = preload_object_auth_ary.first
preload_object_auth.privilege_users = privilege_users
preload_object_auth.save!
end
else
first_category = @bulletin_categorys.first
end
preload_object_auth = first_category.object_auths.where(title: 'fact_check').empty?? (first_category.object_auths.create! :title=> 'fact_check') : first_category.object_auths.where(title: 'fact_check')
@users_array = preload_object_auth.first.privilege_users rescue []
respond_to do |format|
format.html
format.js
end
end
def update_setting
end
# def index
# get_categorys(params[:bulletin_category_id])
#
# @bulletins = params[:sort] ? get_sorted_bulletins : Bulletin.all
# @bulletin_categories = BulletinCategory.all
#
# module_app = ModuleApp.first(:conditions => {:key => 'announcement'})
# @tags = Tag.all(:conditions => {:module_app_id => module_app.id}).order_by(I18n.locale, :asc)
#
# respond_to do |format|
# format.html # index.html.erb
# format.js
# format.xml { render :xml => @bulletins }
# end
# end
#
# def new
#
# end
#
# def create
#
# end
#
# def update
#
# end
#
# def edit
#
# end
#
# def destroy
#
# end
protected
def get_categorys(id = nil)
@bulletin_categorys = []
if(is_manager? || is_admin?)
@bulletin_categorys = (id ? BulletinCategory.find(id).to_a : BulletinCategory.excludes('disabled' => true))
elsif is_sub_manager?
@bulletin_categorys = BulletinCategory.authed_for_user(current_user,'submit_new')
end
end
end

View File

@ -10,6 +10,6 @@
</tr> </tr>
<% bulletin_category.bulletins.each do |post| %> <% bulletin_category.bulletins.each do |post| %>
<%= render :partial => 'panel/announcement/back_end/bulletins/bulletins', :locals => {:post => post,:fact_check_allow=>true} %> <%= render :partial => 'panel/announcement/back_end/bulletins/bulletins', :locals => {:post => post,:approval_allow=>true} %>
<% end %> <% end %>
</table> </table>

View File

@ -25,12 +25,11 @@
</div> </div>
<% end %> <% end %>
<% end %> <% end %>
</div>
<div class="modal-footer"> <div class="modal-footer">
<%= hidden_field_tag 'bulletin_link[bulletin_id]', @bulletin_link.bulletin_id %> <%= hidden_field_tag 'bulletin_link[bulletin_id]', @bulletin_link.bulletin_id %>
<%= f.submit t('submit'), :class=>'btn btn-primary' %> <%= f.submit t('submit'), :class=>'btn btn-primary' %>
<a class="btn" data-dismiss="modal"><%= t('cancel')%></a <a class="btn" data-dismiss="modal"><%= t('cancel')%></a>
</div>
<% end %> <% end %>

View File

@ -1,17 +1,18 @@
<div id="qe-picture" class="qe-edit-div"> <div id="qe-picture" class="qe-edit-div">
<div id="widget-picture"> <div id="widget-picture clear">
<div class="control-group"> <div class="control-group">
<label class="control-label">Picture</label> <!--<label class="control-label">Picture</label>-->
<div class="control-group"> <div class="control-group">
<div class="controls upload-picture">
<img class="pull-left upload-picture" src="" /> <img class="pull-left upload-picture" src="" />
<div class="controls file-upload"> </div>
<label class="control-label btn" for="input-upload"> <div class="controls file-upload input-prepend">
Browse/選擇檔案 <label class="control-label add-on btn" for="input-upload">
<%= t(:browse) %>
<%= f.file_field :image, :id => "input-upload", :class => 'upload', :onchange => "document.getElementById('fu').innerHTML = this.form.fu.value = this.value;" %> <%= f.file_field :image, :id => "input-upload", :class => 'upload', :onchange => "document.getElementById('fu').innerHTML = this.form.fu.value = this.value;" %>
</label> </label>
<span id='fu' class="file-name"></span> <span id='fu' class="file-name"></span>
<br> <input name='fu' class="input-medium qe-picture-rename" type="text">
<input name='fu' class="input-large" type="text">
<br> <br>
<% if bulletin.image.file %> <% if bulletin.image.file %>
<%= f.check_box :remove_image %> <%= f.check_box :remove_image %>

View File

@ -34,11 +34,15 @@
<div id="qe-tags" class="qe-edit-div"> <div id="qe-tags" class="qe-edit-div">
<div id="widget-tags"> <div id="widget-tags">
<div class="controls">
<div class="form-horizontal"> <div class="form-horizontal">
<% @tags.each do |tag| %> <% @tags.each do |tag| %>
<label class="checkbox inline">
<%= check_box_tag 'bulletin[tag_ids][]', tag.id, bulletin.tag_ids.include?(tag.id)%> <%= check_box_tag 'bulletin[tag_ids][]', tag.id, bulletin.tag_ids.include?(tag.id)%>
<%= tag[I18n.locale] %> <%= tag[I18n.locale] %>
</label>
<% end %> <% end %>
</div> </div>
</div> </div>
</div>
</div> </div>

View File

@ -1,15 +0,0 @@
<h1><%= bulletin_category.key %></h1>
<table>
<tr>
<th><%= t('bulletin.status') %></th>
<th><%= t('bulletin.category') %></th>
<th><%= t('bulletin.title') %></th>
<th><%= t('bulletin.postdate') %></th>
<th><%= t('bulletin.deadline') %></th>
<th><%= t('bulletin.action') %></th>
</tr>
<% bulletin_category.bulletins.each do |post| %>
<%= render :partial => 'panel/announcement/back_end/bulletins/bulletins', :locals => {:post => post,:fact_check_allow=>true} %>
<% end %>
</table>

View File

@ -1,50 +0,0 @@
<%= render 'panel/announcement/back_end/bulletins/filter' %>
<table id="bulettin_sort_list" class="table main-list">
<%= render 'panel/announcement/back_end/bulletins/bulletins' %>
</table>
<div class="form-actions">
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('admin.add'), new_panel_announcement_back_end_bulletin_path, :class => 'btn btn-primary' %>
</div>
<!--
<% content_for :secondary do %>
<%#= render :partial => '/panel/announcement/back_end/announcement_secondary' %>
<% end -%>
<%= flash_messages %>
<br />
<br />
<br />
<br />
<br />
<fieldset><legend><%= t('bulletin.search') %></legend>
<%= form_for :bulletin, :action => 'search', :method => 'get', :url => panel_announcement_back_end_bulletins_path do |f| %>
<%#= f.select :bulletin_category_id, @bulletin_categorys.collect {|t| [ t.i18n_variable[I18n.locale], t.id ] },{ :include_blank => t('bulletin.select') }%>
Category <%#= select_tag "category_id", options_for_select(@bulletin_categorys.collect{|t| [t.i18n_variable[I18n.locale], t.id]}), :prompt => t('bulletin.select') %>
KeyWord <%#= text_field_tag :search, params[:search], :id => 'search_field' %>
<%= submit_tag "Search", :name => nil %>
<% end %>
</fieldset>
<br />
<br />
<h1><%= t('bulletin.list_announcement') %></h1>
<div id="check_block">
<h1>Check Please</h1>
<%#= render :partial => "list_table", :collection => @bulletin_categorys_check,:as => :bulletin_category%>
</div>
<br />
-->

View File

@ -1 +0,0 @@
$("#users_checkbox_ary").replaceWith('<%= (render :partial => 'privilege_user', :locals => {:users => @users_array}).html_safe%>');