andreapavoni / panoramic Goto Github PK
View Code? Open in Web Editor NEWstore rails views on database instead of filesystem
License: MIT License
store rails views on database instead of filesystem
License: MIT License
I'd suggest you add support for Travis CI (http://travis-ci.org/) to allow auto-testing of pull requests. :)
Thank you for your work on this gem!
I would kindly ask if it is still maintained since the PR-queue is long..
Best wishes!
Is there a workflow to add criteria to the finder for templates, for example having different templates per user?
For that, I suppose we would have to somehow pass the @current_user to the finder in the controller, and for that to hook into panoramic.
Hi! I am working on a CMS that lets users create/manage templates. These templates should be scoped by theme though. What is the best way to achieve this with panoramic? I see that there is a related issue but it's very old and I think it no longer applies to current versions of the gem and Rails. Thanks in advance for any help!
I want something like this for example:
TemplateStorage.create(body: '###mailer with text and html format', path: 'user_mailer/testing', handler: 'liqmd', formats: ['html', 'text'])
here handler: 'liqmd'
is the liquid_markdown
gem which I am working on. That's the reason I don't have to duplicate records for format: 'html'
and format: 'text'
with exactly same body
. So it would be great if I can put both html
and text
together in format
column.
It is working well if I duplicate record with format: 'html' and format: 'text'
TemplateStorage.create(body: '###mailer with text and html format', path: 'user_mailer/testing', handler: 'liqmd', format: 'html')
TemplateStorage.create(body: '###mailer with text and html format', path: 'user_mailer/testing', handler: 'liqmd', format: 'text')
Thanks
If an exception is raised from a template stored in the database, ActionView::MissingTemplate is thrown which makes it look like the template doesn't exist. The original exception is masked. This makes it impossible to diagnose what's wrong with the template. It would be nice if the gem offered better error handling that actually surfaced the exception from the template.
Hi, first at all thanks for this gem.
Im storing a diferent template for each view, but i dont want to specify the locale.
I have made 2 tests:
any ideas?
I have the following Rails dependency in my project Gemfile:
gem "rails", "3.2.1"
If I try to add Panoramic, I get the following error when running bundle:
Bundler could not find compatible versions for gem "rails":
In Gemfile:
panoramic depends on
rails (~> 3.0.7)
rails (3.2.1)
In rails 6.1 the gem does not work narrowed it down to lib/panoramic/resolver.rb 46
actionview (6.1.0) lib/action_view/template.rb initialize
initalize(source, identifier, handler, locals:, format: nil, variant: nil, virtual_path: nil)
the call to add is made like this
ActionView::Template.new(source, identifier, handler, details)
which does not include locals named argument
was not throwing an error in 6.0 because of default value provided
initalize(source, identifier, handler, format: nil, variant: nil, locals: nil, virtual_path: nil, updated_at: nil)
can be fixed for 6.1 like this
ActionView::Template.new(source, identifier, handler,
:locals => [],
:format => Mime[record.format].to_sym,
:virtual_path => virtual_path(record.path, record.partial))
not sure of what is needed to make it compatible with all versions
here is a pr regarding the fix for 6.1
PR 46
Firstly, congratulations for this initiative.
Is there a way for scoping template model like the following?
class ApplicationController < ActionController::Base
before_filter :database_template
def database_template
prepend_view_path DatabaseTemplate.where(theme: current_theme).resolver
end
def current_theme
# find theme picked by user
end
end
Thanks!
Within section Installation, it must read:
gem "panoramic", "~> 0.0.2"
Within section Usage/Mandatory fiels, the following line ist missing:
format (string): A valid mimetype from Mime::SET.symbols
Could you please show some example data that goes into these fields:
body (text): the source of template (I understand this one)
path (string): where to find template (would 'views/reports' work?)
locale (string): it depends from available locales in your app
handler (string): as locale field, it depends from avaiable handlers (erb, haml, etc...)
partial (boolean): determines if it's a partial or not (false by default)
format (string): A valid mimetype from Mime::SET.symbols
Do they all need to have data? I'm getting 'is not included in the list' when empty.
I'm trying to store a xlsx template in the database. Does this look right?
Path = vehicles/evlist
Locale = en
Handler = axslx
Format = xlsx
NEVER MIND - I got it to work!
Thanks!!!
It seems the view is cached when it is first read in production. Is this related to Rails or Panoramic? I would like to flush the cache when the view is updated.
I would like to somehow prepopulate database with partial/templates from filesystem. Ideally it could be done somehow magically when user clicks particular page.
Thanks for any hints.
Latest gem release was in 2012. Any chance you could release a newer version?
Hi
If I have multiple templates stored in my database - how can I perform a query in my mailer so that my mailer retrieves the template I want to use and uses that to generate the mail message ?
The documentation contains the following snippet ...
class MyEmail < ActionMailer::Base
prepend_view_path TemplateStorage.resolver
but that doesn't give me the control that I need to retrieve the template my mailer needs to use based on supplied criteria
how can I modify the call above ( prepend_view_path TemplateStorage.resolver ) so that arguments are passed to the 'resolver' which can be used to query my templates table and only retrieve the needed template ?
Thanks
Dave
please see #27
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.