Comments (17)
what about configuring it using xml config file and not annotations (I mean Context annotations here)? I think we will be able to reuse the context object classes without relying on the coupled annotations since we will have it in a separate files (not in the classes itself) thus the classes will be independent. In my opinion, in this case abstracting it away from the code would make sense, what do you think about it ?
from web-publisher.
what would be pluses of using context config in seperate xml files? We should be able reuse context object anywhere, annotations are just one way to automatically fill context with needed objects. You will can still use methods like that:
$context->set('article', $article);
from web-publisher.
Fetching data from the context in Twig template
{{ g.get('articles', {param:1})) }}
- function above will fetch articles by given parameters
articles
can be replaced by a different value, e.g.authors
- authors will be fetched by given parameters instead.
Pros:
- one function to maintain (no need to create methods like
getArticles
,getAuthors
etc.) - documenting ease.
Cons:
- ?
from web-publisher.
not sure if those Meta
classes should have methods, imo it would be better to keep there only data and provide template blocks/functions. so there would be g.article.images
list and block:
{{ image src=g.article.images.0 width=300 height=200 }}
<img {{ g.image.params }}>
{{ /image }}
otherwise it's kind of complicated to use that - you have to store the func result somewhere and check it returned something etc.
from web-publisher.
also not sure about this change method, imo it would be better to use blocks again:
{{ article slugline="something" }} here you have the article context {{ /article }} and you're back where you were
this way you can in theory cache that block based on article updated time and in case you can't find it you just don't display it so it's more like component
if article change doesn't work there is no way to continue rendering after..
from web-publisher.
Get single object:
{% get ‘article’ {param: 1} %}
{{ article.name }}
{% endget %}
Get many objects:
{% list ‘articles’ {param: 1} limit=10 %}
{{ article.name }}
{% render_pagination %}
{% endlist %}
from web-publisher.
ok, so to do not forget - i will add this in comment and then update proposal.
Rafał comment (#13 (comment)) is our proposal for template side - fetching single item (different that one in context) and creating loops through collection of objects.
We also decided to keep template "meta" objects configuration in yaml format seperate to entities. This same with phpcr configuration for documents.
Objects exposed for templators will be type of SWP/TemplateEngine/Meta
and will be simple object with __get magic methods witch will expose only defined in configuration properties from storage objects (documents
).
from web-publisher.
looks good. not sure about this meta class thing with magic methods, i would rather keep it simple, more like in newscoop but as long as it's simple to create those meta classes without having an entity it should be fine. concerns for usage of those are - simple json dumping for javascript and using this in unittests.
so can you json_encode()
metaclass?
from web-publisher.
We should be able to json_encode metaclass. And this metaclass will can be filled with any data, by default automatically it will look for public properties and getters in provided object, but still we should be abble to fill it in other ways.
from web-publisher.
should be fine then
from web-publisher.
Hm... it reads like PHP 1.0 :) meaning: is this a template language for front end designers or is this a programming language?
from web-publisher.
Template section is for templators, rest is for developers, and it's realy close to that what we have in Newscoop templates (blocks, and lists).
from web-publisher.
Hi guys, just want to suggest a few things in general, not sure about the specifics. My brain isn't good enough for this. But what do you think about this:
- wording of variables should be the same as in the Superdesk Content API. If it is called "item" in Superdesk, it should not be called "article" in the web publishing template. This I say from experience. Horrible experience. Painful. You don't want that. Please check in with the Content API guys.
- there should be one way of doing something, not many. As much as I like Larry Wall's post modern take on programming ( http://crossfade.walkerart.org/radioqualia/index.html ), if you use gimme, use it everywhere. If you use g. use it everywhere. Do not use both.
- before anything goes into commits, check the name spaces / variable wording with at least one native speaker and at least one newsroom magician. In this case, the language is a tool and means something. We can not accept inaccuracy and sloppy wording.
from web-publisher.
Hey @MiczFlor,
- Main question if people working with templates will need to know that behind web publisher is Superdesk Content API, and if inside Superdesk Web Publisher they will still work with items or maybe with final web product - articles/pages ? Content API naming is designed for developer who will build app on this - not exactly some frontend guy who knows some jQuery and html and have contact do designer.
- There will be one naming - probably gimme ;)
- We will need find newsroom magician, and include him in our pull requests review workflow.
from web-publisher.
Currently in lists we have: length, ordering, ignoring context levels, constraints. Having less than this wouldn't be good.
How this listing will look like in Web publisher? For example some article list rich with options currently looks like this
{{ list_articles length="10" columns="5" ignore_issue="true" ignore_section="true" order="byPopularity desc" constraints="type is news author is $escapedAuthor publish_date greater $threeDaysAgo" }}
how it translates to new system?
from web-publisher.
{% gimmelist article in articles|length(10)|order('popularity, 'desc') with {
type: 'news',
autor: escapedAuthor,
publish_date: '>= '~threeDaysAgo
} %}
from web-publisher.
collumns and ignoring context stuff - not sure if we will have features like that
from web-publisher.
Related Issues (20)
- Not found: /api/bindings/%2F/e/swp_websocket_exchange/q/swp_websocket HOT 2
- Theme could not be installed, files are reverted to previous version!
- Can't install default theme HOT 1
- Logging out does not trigger a back-channel logout to OAuth service
- No logging in prod env
- Tenant for host could not be found HOT 10
- grunt build - GC - Javascript heap out of memory HOT 2
- Command "translation:extract" is not defined. HOT 1
- Documentation - theme
- Error Error Error Error Error Error Error Error Error Error Error Error Error Error Error Error Error Error Error Error!!! help HOT 1
- Tenant for host "123abc" could not be found! Please check tenants configuration. Help!!!
- We facing this issue while installing publisher
- Another Error
- An exception occurred while executing 'DELETE FROM swp_package_author': HOT 1
- Elasticsearch down HOT 1
- Feature request: Follow author HOT 1
- Bug: Article updatedAt field is updated when media is converted to webp HOT 3
- Bug: Duplicate messages are added to image_conversion queue HOT 1
- ERROR: relation "swp_user_reset_password_request" does not exist
- Optimize heavy media file transport in getAssetAction HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from web-publisher.