`
bma
  • 浏览: 56607 次
  • 性别: Icon_minigender_1
  • 来自: 北京
最近访客 更多访客>>
社区版块
存档分类
最新评论

Application skinning/theme support with Rails

阅读更多

Application skinning/theme support with Rails (modified from Rails Recipe)

(please excuse me for writing in English, for there's no input method installed on client's machine.)

Rails provides a lightweight, CSS-driven approach to themes.

1. Add a String field called style to your application’s controller class, say UserController.

ruby 代码
 
  1. attr_accessor = style  
  2.   
  3. def initialize  
  4.     @style = 'default_style'  
  5. end  

2. Modify the app/views/layouts/user.rhtml like the following

xml 代码
 
  1. <html>    
  2.   <head>    
  3.     <%= stylesheet_link_tag(@style) %>  
  4.   </head>  
  5.   <body>  
  6.   ...  
  7.   </body>  
  8. </html>  

3. You can change the theme at runtime using code like the following

ruby 代码
 
  1. def authenticate  
  2.     ...  
  3.     @style = 'user_specific_style'  
  4. end  

Then style sheet be used will change to public/stylesheets/user_specific_style.css

分享到:
评论

相关推荐

    论文报告:Real-time Skeletal Skinning with Optimized Centers of Rotation

    对于论文Real-time Skeletal Skinning with Optimized Centers of Rotation和Efficient Dynamic Skinning with Low-Rank Helper Bone Controllers的报告,里面的视频内容下载链接:...

    PRIMEFACES用户手册PDF版

    • Skinning Framework with 35+ built-in themes and support for visual theme designer tool. • Extensive documentation. • Large, vibrant and active user community. • Developed with "passion" from ...

    GPUSkinning-master.zip

    GPUSkinning学习

    MIT计算机图形学课程6.837课件

    Lec 06 Basics of Computer Animation—Skinning/Enveloping Lec 07 Particle Systems and ODEs Lec 08 Particle Systems and ODE Solvers II, Mass Spring Modeling Assignment 2 Lec 09 Implicit Integration, ...

    Getting Started with Flex 4

    * Change the application’s appearance with styling and skinning * Use Flex components to add charts and graphs "Alaric and Elijah do a great job of guiding a newbie Flex developer through the ...

    VGScene 2.8 FULLSOURCE

    VGScene speeds the development of all graphical application, providing: a graphical editor integrated in IDE, graphical objects, simplify animation, advanced windows and controls, maximum performance,...

    GPUSkinning.unitypackage

    GPUSkinning.unitypackage

    VGScene_2.92.rar

    VGScene speeds the development of all graphical application, providing: a graphical editor integrated in IDE, graphical objects, simplify animation, advanced windows and controls, maximum performance,...

    cegui Falagard_Skinning_System

    cegui Falagard_Skinning_System,详细介绍looknfeel的设计及使用。

    ECS提升GpuSkinning.zip

    ECS提升GpuSkinning.zip

    Skinning Windows XP By Joe Habraken

    Skinning Windows XP By Joe Habraken Pages : 336 有问题,我的QQ:571669275

    Flex4-in-a-day

    The Skinning Contract – Skinning Spark Components Creating Spark components and skins Spark Components/Skins lifecycle New Layout Engine Existing Spark layouts Creating custom Spark layout New ...

    AlphaControls_12.22_Stable

    AlphaControls 2017 -------------------- ... * Improved support of the SKININDESIGN key (coloring of frames at the design-time) * Showing of own hints for glyphs in ComboEdits implemented

    DxScene 4.42 源码版 For D4-D2011

    Advanced skinning engine based on vector graphics styles. Cool exists styles - Dark, Modern, Vista. DXScene can be used to create hardware accelerated 2D applications with cool animation like Cover...

    AlphaControls v14.22

    With AlphaControls, use a new modern way to design enhanced interfaces and make your application more attractive... while adding pleasure and fun to end users. Demonstration Programs ---------------...

    AlphaControls 2017 v12.19 Stable

    With AlphaControls, use a new modern way to design enhanced interfaces and make your application more attractive... while adding pleasure and fun to end users. Demonstration Programs ---------------...

    AlphaControls_13.12_Stable

    The Library contains skinning tool for Delphi 5/6/7/2005-2010/XE-XE8, C++ Builder 6/2006-2010/XE-XE8, RAD Studio 10 Seattle, RAD Studio 10.1 Berlin, RAD Studio 10.2 Tokyo AlphaControls :: history ...

    AlphaControls 2017 v12.11 Stable released

    With AlphaControls, use a new modern way to design enhanced interfaces and make your application more attractive... while adding pleasure and fun to end users. Demonstration Programs ----------------...

    Delphi2010皮肤控件AlphaControls6.21FS

    + Added TsAlphaImageList component with support of Png glyphs with alphachannels and Ico32 * ThirdParty list is empty by default now (use handy editor with predefined values for changing this list) ...

Global site tag (gtag.js) - Google Analytics