Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Web App Theme is a rails generator by Andrea Franz that you can use to generate admin panels quickly. Inspired by cool themes like Lighthouse, Basecamp, RadiantCMS and others, it wants to be an idea to start developing a complete web application layout.
####Rails >= 3.1.0 For this version, all the stylesheets are stored inside the gems assets path. They don't need to be copied to the to the application, unless you want to customize them (using the web_app_theme:assets generator). There only css file generated when you run the theme generator is the web_app_theme.css that includes the theme of your choice. Add to your gemfile:
gem 'web-app-theme', '~> 3.1.0'
####Other versions You can use web-app-theme >= 0.6.2 with Rails 3. If you want to use it with rails 2, use web-app-theme 0.5.3 Specify the web-app-theme gem in your Gemfile, only for :development and :test
group :development, :test do
gem 'web-app-theme', '>= 0.6.2'
end
Used without parameters, it generates the layout inside the application.html.erb file using the default theme.
rails g web_app_theme:theme
You can specify the layout file name in the first parameter:
rails g web_app_theme:theme admin # it will generate a layout called `admin.html.erb`
If you want to use another theme, instead of the default, you can use the --theme
option:
rails g web_app_theme:theme admin --theme="drastic-dark"
You can specify the template engine with --engine=name
option, where name can be erb (default) or haml:
rails g web_app_theme:theme --engine=haml # you must specify haml in your Gemfile
If you want to generate the stylesheets of a specific theme without changing the previously generated layout you can pass the --no-layout
option:
rails g web_app_theme:theme --theme=bec --no-layout
You can specify the text used in the header with the --app-name
option:
rails g web_app_theme:theme --app-name="My New Application"
If you need a layout for login and signup pages, you can use the --type
option with sign
as value. Ìf not specified, the default value is administration
rails g web_app_theme:theme sign --layout-type=sign
Used to copy a theme of your choice from the gem to your application, without parameters it will copy the 'default' theme
rails g web_app_theme:assets --theme=red
This will copy the theme files on your app/assets/stylesheets/web-app-theme path. Also this will copy theme's images to app/assets/images/web-app-theme path
Start creating your controllers manually or with a scaffold, and then use the themed generator
to overwrite the previously generated views.
If you have a controller named like the plural of the used model you can specify just the first parameter:
rails g web_app_theme:themed posts # you have a model named Post and a controller named PostsController
rails g web_app_theme:themed admin/gallery_pictures # you have a model named GalleryPicture and a controller named Admin::GalleryPicturesController
Use the --layout
option specifying the previously generated layout to add a link to the controller you are working on:
rails g web_app_theme:themed posts --layout=admin # you will see the `Posts` link in the navigation
If the controller has a name different to the model used, specify the controller path in the first parameter and the model name in the second one:
rails g web_app_theme:themed items post
rails g web_app_theme:themed admin/items post
If you use will_paginate
for pagination use the --will-paginate
:
rails g web_app_theme:themed items post --will-paginate
You can specify the template engine with --engine=name
option, where name can be erb (default) or haml:
rails g web_app_theme:themed posts --engine=haml
If you have something like map.resource :dashboard
in your routes.rb
file, you can use the --type=text
to generate a view with just text:
rails g web_app_theme:themed dashboards --themed-type=text
If you want to show form error messages inside the generated forms, use the following code inside your environment.rb
ActionView::Base.field_error_proc = Proc.new do |html_tag, instance|
if html_tag =~ /<label/
%|<div class="fieldWithErrors">#{html_tag} <span class="error">#{[instance.error_message].join(', ')}</span></div>|.html_safe
else
html_tag
end
end
If you want to have translated pages, simple create in your locale.yml the keys just like config/locales/en_us.yml example.
en_us:
web-app-theme:
save: Save
cancel: Cancel
list: List
edit: Edit
new: New
show: Show
delete: Delete
confirm: Are you sure?
created_at: Created at
all: All
Andrea Franz - http://gravityblast.com
FAQs
Unknown package
We found that web-app-theme demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.