Giter VIP home page Giter VIP logo

feincms-feincmsext's Introduction

Extensions for FeinCMS.

Various experimental tools and modules for FeinCMS.

Example application is bundled (run ./setup_symlinks.py inside example folder to symlink FeinCMS media files.

extended_navigation

Adds navigation_type fields to pages. Depending on the navigation_type, navigation can be splitted, in primary links, secondary links and so on.

Navigation types can be defined in settings

NAVIGATION_TYPE_CHOICES = (
    ('primary_links', _('primary links')),
    ('secondary_links', _('secondary links')),
)

extended_navigation template tag, together with mptt tree_info template filter renders tree structure.

extended_navigation uses and requires django-templatetag-sugar http://github.com/alex/django-templatetag-sugar

group_page_content

group_page_content templatetag allows more complex layouts by grouping page contents with regular expressions. Here are some examples:

Wrap image content in div, but if it is followed by textcontent group them together under the same div:

{% group_page_content feincms_page.content.main "[imagecontent][rawcontent]?" as content_groups %}

This will return group list, each group will contain name, contents tuple. Name is by integer with value of 0 for 1st match, 1 for 2nd, etc. Groups that were not listed in expression would have value -1.

You can also give groups a name:

{% group_page_content feincms_page.content.main "<myname>[imagecontent][rawcontent]?" as content_groups %}

Group 2 successive text contents together in newsletter like columns:

{% group_page_content feincms_page.content.main "[rawcontent]{2}" as content_groups %}

-group_page_content screenshot

Separate multiple groups with a slash /:

{% group_page_content feincms_page.content.main "[imagecontent][rawcontent]? / [rawcontent][imagecontent]?" as content_groups %}

is_equal_or_parent_or_pretender tag

Use this tag instead of is_equal_or_parent_of filter add current class to HTMl navigation if you use navigation extensions, and structure can be guessed from URL scheme.

TODO: add example

util

Django management command to create structure from text file.

Menu structure file:

# Home
## Menu 1
### Menu 1.1
## Menu 2
### Menu 2.1

This would delete ALL EXISTING PAGES and create structure from file:

./manage.py importstructure --delete_all menus.txt

And this would add structure from the text file to page with id of 1:

./manage.py importstructure --root 1 menus.txt

simple permissions

For any page, following permissions can be set.

  • none - user cannot do anything
  • change - user can edit selected page and all childrent pages
  • all - user can edit all pages in subtree, add new pages or delete them. User cannot remove selected page.

To add simple permission, add 'feincmsext.simple_permission' to INSTALLED_APPS and update AUTHENTICATION_BACKENDS with:

AUTHENTICATION_BACKENDS = (
    'django.contrib.auth.backends.ModelBackend',
    'feincmsext.simple_permission.backend.SimplePagePermissionBackend',
)

Notes:

  • Delete selected pages action does not check permissions (it uses QuerySet.delete())
  • Add child page link is always displayed regardless if page can be added or not

simple permissions are implemented in example app for user1 (pass)

create_content_types

Create content types for given content_types_conf.

content_types_conf is a list or tuple, each element should have content type configuration.

Content type configuration is list or tuple with following elements:

  • content_type - class path or model (can be list)

  • region - region (optional, can be list)

  • options - dictionary to pass as options (optional)

      >>> content_types = [
              (RichTextContent, ), # all regions
              (
                  ('feincms.content.video.models', MediaFileContent), # multiple content types
                  ('main', 'sidebar'), # multiple regions
                  {'TYPE_CHOICES': (('block', 'block'),), # options
              )
              ]
      >>> create_content_type(Page, content_types)
    

feincms-feincmsext's People

Contributors

bmihelac avatar gwildor avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.