Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
关于群策工具的开发

关于群策工具的开发

用到的工具(非必需)

Chrome && Chrome Plugins

RubyMine

  • Navigate MVC Command + Ctrl + Up Arrow

技术

Frameworks

  • Rails 3

Gems

Rails Assocaitions And Delegate

假设一个议题下面又多个意向,而每个意向又有多个意见反馈

Subject(1) <----> Intention(*)

Intention(1) <----> Feedback(*)

subject.rb:

has_many :intentions
has_many :feedbacks, :through => :intentions, :source => :feedbacks


intentions.rb:

belongs_to :subject
has_many :feedbacks

feedback.rb:

belongs_to :intention
delegate :subject, :to => intention, :allow_nil? => true

语言

sass

我用到的

  • variables: $black: #000000;
  • mixins: /app/assets/stylesheets/minixs
  • inheritance: /app/assets/stylesheets/components/cards.css.scss

群策工具的前后台色调不一样,前台是以蓝色为主,后台以绿色为主

我的解决思路:定义两套变量,为不一样的地方使用。

variable.css.scss

$special_color: blue;

variables_for_admin.css.scss

$special_color: green;

准备两套css,一套为admin用户的,另一套为非admin用户

admin: admin.css.scss
non_admin: application.ccs.scss

在模版里引入不同的css即可

- if admin?
  = stylesheet_link_tag "admin", :media => "all"
- else
  = stylesheet_link_tag "application", :media => "all"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.