`
bma
  • 浏览: 57953 次
  • 性别: 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技术在Unity3D中的应用详解》 GPUSkinning,全称GPU骨骼动画,是一种在图形处理单元(GPU)上执行的角色皮肤和骨骼动画技术。相较于传统的CPU驱动的骨骼动画,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, ...

    Styling and Skinning.pdf

    ### 三、Skinning with Images 图像皮肤定制 #### Scale9 图像拉伸 - **概念**:一种图像拉伸技术,允许图像根据控件大小自动调整而不失真。 - **用途**:适用于按钮、边框等需要适应不同尺寸的控件。 #### 使用...

    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,...

    flex skinning 机制实践

    Flex Skinning机制是Adobe Flex框架中的一个重要特性,它允许开发者为UI组件自定义外观和行为,从而实现应用程序的独特设计和交互体验。通过深入理解并实践Flex Skinning,开发者可以更灵活地控制用户界面的视觉样式...

    ECS提升GpuSkinning.zip

    标题中的"ECS提升GpuSkinning"涉及到两个关键概念:ECS(Entity Component System)和GPU Skinning。在Unity游戏引擎中,ECS是一种优化性能的设计模式,而GPU Skinning是用于处理3D角色动画的技术。现在我们来深入...

    GPUSkinning.unitypackage

    GPUSkinning.unitypackage

    falagard skinning ssytem for CEGUI 参考手册翻译

    ### Falagard Skinning System for CEGUI 参考手册翻译 #### 一、Falagard Skinning System 概述 Falagard Skinning System 是 CEGUI (Component Entity GUI) 的一个核心组件,用于实现界面外观(或称为皮肤)的...

    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 的设计与应用 #### 引言与概述 CEGUI(Client-Environment for Graphical User Interfaces)是一款强大的跨平台图形用户界面工具包,广泛应用于游戏开发...

    Skinning Windows XP By Joe Habraken

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

    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 ---------------...

Global site tag (gtag.js) - Google Analytics