Skip to content

Instantly share code, notes, and snippets.

@import "active_admin/mixins"
@import "active_admin/components/links"
body
@include global-reset
@import "active_admin/typography"
@import "active_admin/header"
@import "active_admin/forms"
@import "active_admin/components/comments"
@import "active_admin/components/flash_messages"
# your-engine/lib/magic/rails/engine.rb
module Magic
module Rails
module Engine
##
# Automatically append all of the current engine's routes to the main
# application's route set. This needs to be done for ALL functional tests that
# use engine routes, since the mounted routes don't work during tests.
#
# app/models/my_model.rb
module MyApp
module Model
def self.included(base)
base.send :include, Mongoid::Document
base.send :include, Mongoid::Timestamps
base.send :include, ActiveAdmin::Mongoid::Patches
end
end
@danil-z
danil-z / dashboard.rb
Created September 1, 2011 19:33
app/components/dashboard.rb
class Dashboard < Netzke::Base
ex = Netzke::Core.ext_path.join("examples/desktop/js")
js_include ex.join("Desktop.js"), ex.join("App.js") , ex.join("FitAllLayout.js"), ex.join("Module.js")
js_include ex.join("ShortcutModel.js"), ex.join("StartMenu.js"), ex.join("TaskBar.js"), ex.join("Wallpaper.js")
js_base_class "Ext.ux.desktop.App"
js_mixin :main
end
@danil-z
danil-z / simple_app.rb
Created August 8, 2011 14:02
simple_app bug
class VoipRateApp < Netzke::Basepack::SimpleApp
def configuration
orig = super
orig.merge(:items => [{
:region => :center,
:class_name => "Basepack::GridPanel",
:model => "Rate",
:enable_edit_in_form => false,
:rows_per_page => 50,
class ScheduleGrid < Netzke::Basepack::GridPanel
#....
# i think it's too annoing click "add row" button if you add many rows in grid
# this addition to gridpanel allow you add a row automaticaly
# when you finished edit last row and hit tab or enter
js_method :walk_cells, <<-JS
function(row, col, step, fn, scope) {
var cell = #{js_full_class_name}.superclass.walkCells.apply(this, arguments);
if (!cell&&step>0) {
@danil-z
danil-z / JournalSubjectTabPanel.rb
Created March 9, 2011 20:04
components in session
module Blackbumer
class JournalSubjectTabPanel < Netzke::Base
js_base_class "Ext.TabPanel"
def final_config
tabs = stored_tabs.map { |tab| {:layout => :fit, :name => tab[:name], :title => tab[:title], :items => [ tab[:name].to_sym.component]} } || []
orig = super
orig.merge(
:items => tabs
)
end
@danil-z
danil-z / tabpanel
Created January 30, 2011 11:55
tabpanel.load
class JournalPanel < Netzke::Basepack::BorderLayoutPanel
js_property :header, false
def configuration
school_id = super[:school_id] || component_session[:selected_school_id].to_i
component_session[:selected_school_id] = school_id
school = School.find(school_id)
classroom_store = school.classrooms.order(:number,:letter).collect {|c|[c.id,c.title]}
super.merge(
:tbar => [{xtype: 'tbtext', :text => "#{I18n.t(:journal)} - #{school.title}, #{I18n.t('activerecord.attributes.classroom.title')}: "}, ' ',
{:name => :classroom, :id => :classroom, :xtype => :combo, :editable => false, :trigger_action => :all,
@danil-z
danil-z / netzke_columns
Created January 20, 2011 09:45
how to send id instead of title
class SchedulePanel < Netzke::Basepack::BorderLayoutPanel
js_property :header, false
def configuration
school_id = super[:school_id] || component_session[:selected_school_id].to_i
component_session[:selected_school_id] = school_id
subjects_store = Subject.order(:title).all.collect {|c|[c.id,c.title]}
school = School.find(school_id)
classroom_store = school.classrooms.order(:number,:letter).collect {|c|[c.id,c.title]}
period_store = school.type_period.periods.order(:title).collect {|c|[c.id,c.title]}
teacher_store = school.teachers.order(:full_name).map(&:full_name)