Changeset - fe053a42c4ce
[Not reviewed]
beta
0 7 0
Marcin Kuzminski - 12 years ago 2013-05-28 16:57:24
marcin@python-works.com
added dashboard items config in visual settings
7 files changed with 23 insertions and 14 deletions:
0 comments (0 inline, 0 general)
development.ini
Show inline comments
 
@@ -97,27 +97,24 @@ cut_off_limit = 256000
 
## use cache version of scm repo everywhere
 
vcs_full_cache = true
 

	
 
## force https in RhodeCode, fixes https redirects, assumes it's always https
 
force_https = false
 

	
 
## use Strict-Transport-Security headers
 
use_htsts = false
 

	
 
## number of commits stats will parse on each iteration
 
commit_parse_limit = 25
 

	
 
## number of items displayed in lightweight dashboard before paginating is shown
 
dashboard_items = 100
 

	
 
## use gravatar service to display avatars
 
use_gravatar = true
 

	
 
## path to git executable
 
git_path = git
 

	
 
## git rev filter option, --all is the default filter, if you need to
 
## hide all refs in changelog switch this to --branches --tags
 
git_rev_filter=--all
 

	
 
## RSS feed options
 
rss_cut_off_limit = 256000
production.ini
Show inline comments
 
@@ -97,27 +97,24 @@ cut_off_limit = 256000
 
## use cache version of scm repo everywhere
 
vcs_full_cache = true
 

	
 
## force https in RhodeCode, fixes https redirects, assumes it's always https
 
force_https = false
 

	
 
## use Strict-Transport-Security headers
 
use_htsts = false
 

	
 
## number of commits stats will parse on each iteration
 
commit_parse_limit = 25
 

	
 
## number of items displayed in lightweight dashboard before paginating is shown
 
dashboard_items = 100
 

	
 
## use gravatar service to display avatars
 
use_gravatar = true
 

	
 
## path to git executable
 
git_path = git
 

	
 
## git rev filter option, --all is the default filter, if you need to
 
## hide all refs in changelog switch this to --branches --tags
 
git_rev_filter=--all
 

	
 
## RSS feed options
 
rss_cut_off_limit = 256000
rhodecode/config/deployment.ini_tmpl
Show inline comments
 
@@ -97,27 +97,24 @@ cut_off_limit = 256000
 
## use cache version of scm repo everywhere
 
vcs_full_cache = true
 

	
 
## force https in RhodeCode, fixes https redirects, assumes it's always https
 
force_https = false
 

	
 
## use Strict-Transport-Security headers
 
use_htsts = false
 

	
 
## number of commits stats will parse on each iteration
 
commit_parse_limit = 25
 

	
 
## number of items displayed in lightweight dashboard before paginating is shown
 
dashboard_items = 100
 

	
 
## use gravatar service to display avatars
 
use_gravatar = true
 

	
 
## path to git executable
 
git_path = git
 

	
 
## git rev filter option, --all is the default filter, if you need to
 
## hide all refs in changelog switch this to --branches --tags
 
git_rev_filter=--all
 

	
 
## RSS feed options
 
rss_cut_off_limit = 256000
rhodecode/controllers/admin/settings.py
Show inline comments
 
@@ -174,44 +174,50 @@ class SettingsController(BaseController)
 
            try:
 
                form_result = application_form.to_python(dict(request.POST))
 
            except formencode.Invalid, errors:
 
                return htmlfill.render(
 
                     render('admin/settings/settings.html'),
 
                     defaults=errors.value,
 
                     errors=errors.error_dict or {},
 
                     prefix_error=False,
 
                     encoding="UTF-8"
 
                )
 

	
 
            try:
 
                #TODO: rewrite this to something less ugly
 
                sett1 = RhodeCodeSetting.get_by_name_or_create('show_public_icon')
 
                sett1.app_settings_value = \
 
                    form_result['rhodecode_show_public_icon']
 
                Session().add(sett1)
 

	
 
                sett2 = RhodeCodeSetting.get_by_name_or_create('show_private_icon')
 
                sett2.app_settings_value = \
 
                    form_result['rhodecode_show_private_icon']
 
                Session().add(sett2)
 

	
 
                sett3 = RhodeCodeSetting.get_by_name_or_create('stylify_metatags')
 
                sett3.app_settings_value = \
 
                    form_result['rhodecode_stylify_metatags']
 
                Session().add(sett3)
 

	
 
                sett4 = RhodeCodeSetting.get_by_name_or_create('repository_fields')
 
                sett4.app_settings_value = \
 
                    form_result['rhodecode_repository_fields']
 
                Session().add(sett4)
 

	
 
                sett5 = RhodeCodeSetting.get_by_name_or_create('dashboard_items')
 
                sett5.app_settings_value = \
 
                    form_result['rhodecode_dashboard_items']
 
                Session().add(sett5)
 

	
 
                Session().commit()
 
                set_rhodecode_config(config)
 
                h.flash(_('Updated visualisation settings'),
 
                        category='success')
 

	
 
            except Exception:
 
                log.error(traceback.format_exc())
 
                h.flash(_('Error occurred during updating '
 
                          'visualisation settings'),
 
                        category='error')
 

	
 
        if setting_id == 'vcs':
rhodecode/lib/base.py
Show inline comments
 
@@ -258,36 +258,37 @@ class BaseController(WSGIController):
 
    def __before__(self):
 
        """
 
        __before__ is called before controller methods and after __call__
 
        """
 
        c.rhodecode_version = __version__
 
        c.rhodecode_instanceid = config.get('instance_id')
 
        c.rhodecode_name = config.get('rhodecode_title')
 
        c.use_gravatar = str2bool(config.get('use_gravatar'))
 
        c.ga_code = config.get('rhodecode_ga_code')
 
        # Visual options
 
        c.visual = AttributeDict({})
 
        rc_config = RhodeCodeSetting.get_app_settings()
 

	
 
        ## DB stored
 
        c.visual.show_public_icon = str2bool(rc_config.get('rhodecode_show_public_icon'))
 
        c.visual.show_private_icon = str2bool(rc_config.get('rhodecode_show_private_icon'))
 
        c.visual.stylify_metatags = str2bool(rc_config.get('rhodecode_stylify_metatags'))
 
        c.visual.dashboard_items = safe_int(config.get('dashboard_items', 100))
 
        c.visual.dashboard_items = safe_int(rc_config.get('rhodecode_dashboard_items', 100))
 
        c.visual.repository_fields = str2bool(rc_config.get('rhodecode_repository_fields'))
 
        ## INI stored
 
        self.cut_off_limit = int(config.get('cut_off_limit'))
 

	
 
        c.repo_name = get_repo_slug(request)  # can be empty
 
        c.backends = BACKENDS.keys()
 
        c.unread_notifications = NotificationModel()\
 
                        .get_unread_cnt_for_user(c.rhodecode_user.user_id)
 
        self.cut_off_limit = int(config.get('cut_off_limit'))
 

	
 
        self.sa = meta.Session
 
        self.scm_model = ScmModel(self.sa)
 

	
 
    def __call__(self, environ, start_response):
 
        """Invoke the Controller"""
 
        # WSGIController.__call__ dispatches to the Controller method
 
        # the request is routed to. This routing information is
 
        # available in environ['pylons.routes_dict']
 
        try:
 
            self.ip_addr = _get_ip_addr(environ)
 
            # make sure that we update permissions each time we call controller
 
            api_key = request.GET.get('api_key')
rhodecode/model/forms.py
Show inline comments
 
@@ -276,24 +276,25 @@ def ApplicationSettingsForm():
 

	
 

	
 
def ApplicationVisualisationForm():
 
    class _ApplicationVisualisationForm(formencode.Schema):
 
        allow_extra_fields = True
 
        filter_extra_fields = False
 
        rhodecode_show_public_icon = v.StringBoolean(if_missing=False)
 
        rhodecode_show_private_icon = v.StringBoolean(if_missing=False)
 
        rhodecode_stylify_metatags = v.StringBoolean(if_missing=False)
 

	
 
        rhodecode_repository_fields = v.StringBoolean(if_missing=False)
 
        rhodecode_lightweight_journal = v.StringBoolean(if_missing=False)
 
        rhodecode_dashboard_items = v.UnicodeString()
 

	
 
    return _ApplicationVisualisationForm
 

	
 

	
 
def ApplicationUiSettingsForm():
 
    class _ApplicationUiSettingsForm(formencode.Schema):
 
        allow_extra_fields = True
 
        filter_extra_fields = False
 
        web_push_ssl = v.StringBoolean(if_missing=False)
 
        paths_root_path = All(
 
            v.ValidPath(),
 
            v.UnicodeString(strip=True, min=1, not_empty=True)
rhodecode/templates/admin/settings/settings.html
Show inline comments
 
@@ -124,40 +124,50 @@
 
        <!-- fields -->
 

	
 
        <div class="fields">
 
             <div class="field">
 
                <div class="label label-checkbox">
 
                    <label>${_('General')}:</label>
 
                </div>
 
                <div class="checkboxes">
 
                    <div class="checkbox">
 
                        ${h.checkbox('rhodecode_repository_fields','True')}
 
                        <label for="rhodecode_repository_fields">${_('Use repository extra fields')}</label>
 
                    </div>
 
                    <span class="help-block">${_('Allows storing additional customized fields per repository.')}</span>
 
                </div>
 
             </div>
 

	
 
            <div class="field">
 
                <div class="label">
 
                    <label for="rhodecode_realm">${_('Dashboard items')}:</label>
 
                </div>
 
                <div class="input">
 
                    ${h.text('rhodecode_dashboard_items',size=5)}
 
                    <span class="help-block">${_('Number of items displayed in lightweight dashboard before pagination is shown.')}</span>
 
                </div>
 
            </div>
 
             <div class="field">
 
                <div class="label label-checkbox">
 
                    <label>${_('Icons')}:</label>
 
                </div>
 
                <div class="checkboxes">
 
                    <div class="checkbox">
 
                        ${h.checkbox('rhodecode_show_public_icon','True')}
 
                        <label for="rhodecode_show_public_icon">${_('Show public repo icon on repositories')}</label>
 
                    </div>
 
                    <div class="checkbox">
 
                        ${h.checkbox('rhodecode_show_private_icon','True')}
 
                        <label for="rhodecode_show_private_icon">${_('Show private repo icon on repositories')}</label>
 
                    </div>
 
                    <span class="help-block">${_('Show public/private icons next to repositories names')}</span>
 
                 </div>
 
             </div>
 

	
 
             <div class="field">
 
                <div class="label label-checkbox">
 
                    <label>${_('Meta-Tagging')}:</label>
 
                </div>
 
                <div class="checkboxes">
 
                    <div class="checkbox">
 
                        ${h.checkbox('rhodecode_stylify_metatags','True')}
 
                        <label for="rhodecode_stylify_metatags">${_('Stylify recognised metatags:')}</label>
 
                    </div>
0 comments (0 inline, 0 general)