Channel Videos Mobile Sites Partial

This commit is contained in:
saurabhbhatia 2013-12-03 15:50:27 +08:00
parent 888f41a959
commit e87c678eb7
14 changed files with 41 additions and 18 deletions

View File

@ -22,7 +22,7 @@ class Admin::SitesController < OrbitBackendController
def update def update
if params[:site][:default_locale] && @site.enable_language_detection.eql?(true) if params[:site][:default_locale] && @site.enable_language_detection.eql?(true)
Site.update_all({:enable_language_detection => false}) Site.update_all({:enable_language_detection => false})
elsif params[:site][:enable_language_detection] && @site.default_locale.present? elsif params[:site][:enable_language_detection] && @site.default_locale.present?
Site.update_all({:default_locale => nil}) Site.update_all({:default_locale => nil})
end end

View File

@ -5,6 +5,7 @@ class MobileController < ApplicationController
before_filter :no_footer_for_app before_filter :no_footer_for_app
def index def index
@site = Site.first
date_now = Time.now date_now = Time.now
@bulletins = Bulletin.all.available_for_lang(I18n.locale).can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page(params[:page_main]).per(15) @bulletins = Bulletin.all.available_for_lang(I18n.locale).can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page(params[:page_main]).per(15)
@ad_banner = AdBanner.find(:all, :conditions => {:title => /Home/i})[0] @ad_banner = AdBanner.find(:all, :conditions => {:title => /Home/i})[0]

View File

@ -1,10 +1,3 @@
class UserMailer < Devise::Mailer class UserMailer < Devise::Mailer
default :from => "noreply@rulingcom.com" default :from => "noreply@rulingcom.com"
def password_reset(user, password)
@user = user
@password = password
mail(:to => user.email,
:subject => 'Password Reset Notification')
end
end end

View File

@ -19,6 +19,7 @@ class Site
field :sitemap_menu_in_header, :type => Boolean, :default => false field :sitemap_menu_in_header, :type => Boolean, :default => false
field :enable_terms_of_use, :type => Boolean, :default => false field :enable_terms_of_use, :type => Boolean, :default => false
field :enable_language_detection, :type => Boolean, :default => false field :enable_language_detection, :type => Boolean, :default => false
field :enable_announcement_mobile, :type => Boolean, :default => false
field :title_always_on, :type => Boolean, :default => false field :title_always_on, :type => Boolean, :default => false
field :dashbroad_allow_visitor, :type => Boolean, :default => false field :dashbroad_allow_visitor, :type => Boolean, :default => false

View File

@ -22,6 +22,11 @@ class User
field :cache_dept,type: Hash field :cache_dept,type: Hash
field :status_record,type: Hash field :status_record,type: Hash
field :approved, type: Boolean, :default => false field :approved, type: Boolean, :default => false
field :reset_password_token, :type => String
field :reset_password_sent_at, :type => Time
field :remember_created_at, :type => Time
attr_accessible :remember_me
has_and_belongs_to_many :approving_apps, class_name: 'AuthApproval', inverse_of: 'authorized_users' has_and_belongs_to_many :approving_apps, class_name: 'AuthApproval', inverse_of: 'authorized_users'
has_and_belongs_to_many :managing_apps, class_name: 'AuthManager', inverse_of: 'authorized_users' has_and_belongs_to_many :managing_apps, class_name: 'AuthManager', inverse_of: 'authorized_users'

View File

@ -20,12 +20,20 @@
<!-- Enable Mobile Web --> <!-- Enable Mobile Web -->
<div class="control-group"> <div class="control-group">
<label class="control-label muted"><%= I18n.t('site.mobile_version')%></label> <label class="control-label muted"><%= I18n.t('site.mobile_version')%></label>
<div class="controls"> <div id="mobile-site" class="controls">
<%= f.check_box :mobile_on , :class=>"toggle-check", :data=> { disabled: true } %> <%= f.check_box :mobile_on , :class=>"toggle-check", :data=> { disabled: true } %>
<span class="help-block">Enable Mobile Website</span> <span class="help-block">Enable Mobile Website</span>
</div> </div>
</div> </div>
<div id="settings" class="control-group">
<label class="control-label muted"><%= I18n.t('site.announcement')%></label>
<div class="controls">
<%= f.check_box :enable_announcement_mobile , :class=>"toggle-check", :data=> { disabled: true } %>
<span class="help-block">Enable Announcements</span>
</div>
</div>
<div class="control-group"> <div class="control-group">
<label class="control-label muted"><%= I18n.t('site.mobile_api_openness_on') %></label> <label class="control-label muted"><%= I18n.t('site.mobile_api_openness_on') %></label>
<div class="controls"> <div class="controls">

View File

@ -3,7 +3,8 @@
<%= image_tag image.file.url, width: @ad_banner.width, height: @ad_banner.height %> <%= image_tag image.file.url, width: @ad_banner.width, height: @ad_banner.height %>
<% end %> <% end %>
</div> </div>
<div class="newlist clear"> <% if @site.enable_announcement_mobile %>
<div class="newlist clear">
<% @bulletins.each do |bulletin| %> <% @bulletins.each do |bulletin| %>
<div class="newitem"> <div class="newitem">
<div class="newpic"> <div class="newpic">
@ -16,8 +17,8 @@
<div class="newsummary"><%= bulletin.subtitle %></div> <div class="newsummary"><%= bulletin.subtitle %></div>
</div> </div>
<% end %> <% end %>
</div> </div>
<% end %>
<script type='text/javascript'> <script type='text/javascript'>
$(function(){ $(function(){
if($("#slideshow-<%= @ad_banner.title.dehumanize %> img").length > 1){ if($("#slideshow-<%= @ad_banner.title.dehumanize %> img").length > 1){

View File

@ -25,7 +25,7 @@ Orbit::Application.configure do
# config.cache_store = :mem_cache_store # config.cache_store = :mem_cache_store
config.action_mailer.default_url_options = { :host => 'harry.tp.rulingcom.com' } config.action_mailer.default_url_options = { :host => 'localhost:3000' }
config.assets.debug = false config.assets.debug = false

View File

@ -3,7 +3,7 @@
Devise.setup do |config| Devise.setup do |config|
# ==> Mailer Configuration # ==> Mailer Configuration
# Configure the e-mail address which will be shown in DeviseMailer. # Configure the e-mail address which will be shown in DeviseMailer.
config.mailer_sender = "UserMailer" config.mailer_sender = "noreply@rulingcom.com"
# Configure the class responsible to send e-mails. # Configure the class responsible to send e-mails.
config.mailer = "Devise::Mailer" config.mailer = "Devise::Mailer"

View File

@ -401,6 +401,7 @@ en:
keywords_help: Keyword Guide keywords_help: Keyword Guide
language: Site language language: Site language
mobile_version: Enable Mobile Web mobile_version: Enable Mobile Web
announcement: Announcement
openness: Openness openness: Openness
search: Site Search search: Site Search
search_help: Please Enter the search argument for Google search. search_help: Please Enter the search argument for Google search.

View File

@ -402,6 +402,7 @@ zh_tw:
keywords_help: 關鍵字說明 keywords_help: 關鍵字說明
language: 網站語言 language: 網站語言
mobile_version: 手機版 mobile_version: 手機版
announcement: 公告
openness: 開放模式 openness: 開放模式
search: 網站搜尋 search: 網站搜尋
search_help: 請輸入送交Google搜尋的參數 search_help: 請輸入送交Google搜尋的參數

View File

@ -4,7 +4,7 @@ class Panel::Video::FrontEnd::ChannelVideosController < OrbitWidgetController
@app_title = 'video' @app_title = 'video'
end end
def channel_videos def index
@item = Page.find(params[:page_id]) rescue nil @item = Page.find(params[:page_id]) rescue nil
if @item if @item
if @item.frontend_data_count if @item.frontend_data_count
@ -15,10 +15,12 @@ class Panel::Video::FrontEnd::ChannelVideosController < OrbitWidgetController
@frontend_style = @item.frontend_style @frontend_style = @item.frontend_style
end end
@item = Page.find(params[:page_id]) rescue nil @item = Page.find(params[:page_id]) rescue nil
if !params[:category_id].blank? || !params[:tag_id].blank? @channel_video = ChannelVideo.first rescue nil
@channel_video = ChannelVideo.find(@part.widget_options['channel_videos']) rescue nil
client = YouTubeIt::Client.new(:dev_key => "AI39si5KGPg8rhKLBfmeukit2tCSP_B9lT8igiNICbrbgUXQoAdYGvsyCGCmO1wGnr1OW4bDRv-ESolwk-rdBNIAgVTL9VYaEA") client = YouTubeIt::Client.new(:dev_key => "AI39si5KGPg8rhKLBfmeukit2tCSP_B9lT8igiNICbrbgUXQoAdYGvsyCGCmO1wGnr1OW4bDRv-ESolwk-rdBNIAgVTL9VYaEA")
@client_videos = client.videos_by(:user => @channel_video.channel_name, :per_page => 5) @client_videos = client.videos_by(:user => @channel_video.channel_name, :per_page => 5)
respond_to do |format|
format.html # index.html.erb
end end
end end
end end

View File

@ -0,0 +1,9 @@
<h2>Videos</h2>
<ul class="video-list">
<% @client_videos.videos.each do |v| %>
<% @video = v.video_id.split(/tag:youtube.com,2008:video:+/).last %>
<% @vd = UnvlogIt.new("https://www.youtube.com/watch?v=#{@video}")%>
<li><p class="video-title"><%= @vd.title %>
<div class="video"><%=link_to image_tag(@vd.thumbnail, :size => '200x150'), "https://www.youtube.com/watch?v=#{@video}", :target => "blank" %></div></li>
<%end%>

View File

@ -8,7 +8,8 @@ Rails.application.routes.draw do
end end
namespace :front_end do namespace :front_end do
match "/channel_videos" => "channel_videos#channel_videos", :via => :get resources :channel_videos
# match "/channel_videos" => "channel_videos#channel_videos", :via => :get
end end
namespace :widget do namespace :widget do
#resources :channel_videos #resources :channel_videos