Let communications add some CSS that gets inlined

Bug #1534231 reported by Paul Everitt
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
KARL4
Fix Released
Medium
Carlos de la Guardia

Bug Description

OSF communications wants a way to edit some CSS in KARL that gets injected into pages.

I propose we let them edit TTW. We don't want them to have to wait for our release process and we don't want to restart KARL (and die a cache death for 5 hours) whenever they need a change.

Editing
=========

I propose that we jam this textarea on a form that they already have access to. For example /offices/nyc/edit_intranet.html

Injecting
==========

We first need to ask them if this is scoped to /offices/nyc URLs.

Next, we should decide if we want it inlined in a <style></style> in the layout templates, or in a <link rel="stylesheet"/> that points to a URL which returns the CSS from the database. I will let you choose the direction on that.

Make sure that tests still pass after this.

Revision history for this message
Carlos de la Guardia (cguardia) wrote :

Got this almost ready, but forgot to ask if scope will be /offices/nyc or other.

Revision history for this message
Paul Everitt (paul-agendaless) wrote : Re: [Bug 1534231] Let communications add some CSS that gets inlined

Since /offices doesn’t have a good UI for this, let’s stick it on /offices/nyc for editing then inject it globally for all pages in all base templates.

Again, it’s your decision whether to inline it with <script> (easiest) or make it available by <link>.

—Paul

> On Jan 18, 2016, at 4:41 AM, Carlos de la Guardia <email address hidden> wrote:
>
> Got this almost ready, but forgot to ask if scope will be /offices/nyc
> or other.
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1534231
>
> Title:
> Let communications add some CSS that gets inlined
>
> Status in KARL4:
> New
>
> Bug description:
> OSF communications wants a way to edit some CSS in KARL that gets
> injected into pages.
>
> I propose we let them edit TTW. We don't want them to have to wait for
> our release process and we don't want to restart KARL (and die a cache
> death for 5 hours) whenever they need a change.
>
> Editing
> =========
>
> I propose that we jam this textarea on a form that they already have
> access to. For example /offices/nyc/edit_intranet.html
>
> Injecting
> ==========
>
> We first need to ask them if this is scoped to /offices/nyc URLs.
>
> Next, we should decide if we want it inlined in a <style></style> in
> the layout templates, or in a <link rel="stylesheet"/> that points to
> a URL which returns the CSS from the database. I will let you choose
> the direction on that.
>
> Make sure that tests still pass after this.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/karl4/+bug/1534231/+subscriptions

Revision history for this message
Carlos de la Guardia (cguardia) wrote :

Committed first version to custom_css branch. All intranets get the css field, but it's local for all, except ./offices/nyc. Seemed a little less contrived to me than adding checks for nyc to the form field code, plus you get custom css for intranets. Not sure you'll agree, though.

Changed in karl4:
status: New → Fix Committed
Revision history for this message
Paul Everitt (paul-agendaless) wrote :

I think you picked the right approach.

Good job on remembering to inject it in all 4 of the layout templates.

—Paul

> On Jan 19, 2016, at 2:11 AM, Carlos de la Guardia <email address hidden> wrote:
>
> Committed first version to custom_css branch. All intranets get the css
> field, but it's local for all, except ./offices/nyc. Seemed a little
> less contrived to me than adding checks for nyc to the form field code,
> plus you get custom css for intranets. Not sure you'll agree, though.
>
> ** Changed in: karl4
> Status: New => Fix Committed
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1534231
>
> Title:
> Let communications add some CSS that gets inlined
>
> Status in KARL4:
> Fix Committed
>
> Bug description:
> OSF communications wants a way to edit some CSS in KARL that gets
> injected into pages.
>
> I propose we let them edit TTW. We don't want them to have to wait for
> our release process and we don't want to restart KARL (and die a cache
> death for 5 hours) whenever they need a change.
>
> Editing
> =========
>
> I propose that we jam this textarea on a form that they already have
> access to. For example /offices/nyc/edit_intranet.html
>
> Injecting
> ==========
>
> We first need to ask them if this is scoped to /offices/nyc URLs.
>
> Next, we should decide if we want it inlined in a <style></style> in
> the layout templates, or in a <link rel="stylesheet"/> that points to
> a URL which returns the CSS from the database. I will let you choose
> the direction on that.
>
> Make sure that tests still pass after this.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/karl4/+bug/1534231/+subscriptions

Revision history for this message
Paul Everitt (paul-agendaless) wrote :
Download full text (5.3 KiB)

I am getting:

Exception when processing https://karlstaging.gocept.com/login.html
Referer: None
Traceback (most recent call last):
  File "/srv/karlstaging/staging/23/eggs/pyramid-1.2.1-py2.7.egg/pyramid/tweens.py", line 17, in excview_tween
    response = handler(request)
  File "/srv/karlstaging/staging/23/eggs/pyramid_tm-0.5-py2.7.egg/pyramid_tm/__init__.py", line 107, in tm_tween
    return response
  File "/srv/karlstaging/staging/23/eggs/pyramid_tm-0.5-py2.7.egg/pyramid_tm/__init__.py", line 75, in __exit__
    return self._retry_or_raise(t, v, tb)
  File "/srv/karlstaging/staging/23/eggs/pyramid_tm-0.5-py2.7.egg/pyramid_tm/__init__.py", line 60, in _retry_or_raise
    reraise(t, v, tb) # otherwise reraise the exception
  File "/srv/karlstaging/staging/23/eggs/pyramid_tm-0.5-py2.7.egg/pyramid_tm/__init__.py", line 100, in tm_tween
    response = handler(request)
  File "/srv/karlstaging/staging/23/eggs/pyramid-1.2.1-py2.7.egg/pyramid/router.py", line 153, in handle_request
    response = view_callable(context, request)
  File "/srv/karlstaging/staging/23/eggs/pyramid-1.2.1-py2.7.egg/pyramid/config/views.py", line 319, in viewresult_to_response
    result = view(context, request)
  File "/srv/karlstaging/staging/23/src/karl/karl/views/login.py", line 100, in login_view
    request=request)
  File "/srv/karlstaging/staging/23/eggs/pyramid-1.2.1-py2.7.egg/pyramid/renderers.py", line 114, in render_to_response
    return helper.render_to_response(value, None, request=request)
  File "/srv/karlstaging/staging/23/eggs/pyramid-1.2.1-py2.7.egg/pyramid/renderers.py", line 422, in render_to_response
    result = self.render(value, system_values, request=request)
  File "/srv/karlstaging/staging/23/eggs/pyramid-1.2.1-py2.7.egg/pyramid/renderers.py", line 418, in render
    result = renderer(value, system_values)
  File "/srv/karlstaging/staging/23/eggs/pyramid-1.2.1-py2.7.egg/pyramid/chameleon_zpt.py", line 49, in __call__
    result = self.template(**system)
  File "/srv/karlstaging/staging/23/eggs/Chameleon-2.8.2-py2.7.egg/chameleon/template.py", line 125, in __call__
    return self.render(**kwargs)
  File "/srv/karlstaging/staging/23/eggs/Chameleon-2.8.2-py2.7.egg/chameleon/zpt/template.py", line 258, in render
    return super(PageTemplate, self).render(**vars)
  File "/srv/karlstaging/staging/23/eggs/Chameleon-2.8.2-py2.7.egg/chameleon/template.py", line 191, in render
    raise_with_traceback(exc, tb)
  File "/srv/karlstaging/staging/23/eggs/Chameleon-2.8.2-py2.7.egg/chameleon/template.py", line 172, in render
    self._render(stream, econtext, rcontext)
  File "login_8c839bab4b8d3d166259c2fd93be2a5ccd3f7b5c.py", line 574, in render
  File "/srv/karlstaging/staging/23/eggs/Chameleon-2.8.2-py2.7.egg/chameleon/zpt/template.py", line 262, in include
    self._render(*args, **kwargs)
  File "anonymous_layout_6925c8f0e98de2e2e68608a2bdd1c36a37864855.py", line 123, in render
  File "/srv/karlstaging/staging/23/eggs/Chameleon-2.8.2-py2.7.egg/chameleon/py26.py", line 12, in lookup_attr
    raise exc
AttributeError: 'Community' object has no attribute 'css'

 - Expression: "api.custom_css"
 - Filename: /srv/karlstaging/staging/23/src/karl/karl/v...

Read more...

Revision history for this message
Carlos de la Guardia (cguardia) wrote :

Mmm, can't duplicate that error, but added some safeguards to the custom_css property. Should work now.

Revision history for this message
Paul Everitt (paul-agendaless) wrote :

Yep, that did it.

—Paul

> On Jan 19, 2016, at 2:12 PM, Carlos de la Guardia <email address hidden> wrote:
>
> Mmm, can't duplicate that error, but added some safeguards to the
> custom_css property. Should work now.
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1534231
>
> Title:
> Let communications add some CSS that gets inlined
>
> Status in KARL4:
> Fix Committed
>
> Bug description:
> OSF communications wants a way to edit some CSS in KARL that gets
> injected into pages.
>
> I propose we let them edit TTW. We don't want them to have to wait for
> our release process and we don't want to restart KARL (and die a cache
> death for 5 hours) whenever they need a change.
>
> Editing
> =========
>
> I propose that we jam this textarea on a form that they already have
> access to. For example /offices/nyc/edit_intranet.html
>
> Injecting
> ==========
>
> We first need to ask them if this is scoped to /offices/nyc URLs.
>
> Next, we should decide if we want it inlined in a <style></style> in
> the layout templates, or in a <link rel="stylesheet"/> that points to
> a URL which returns the CSS from the database. I will let you choose
> the direction on that.
>
> Make sure that tests still pass after this.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/karl4/+bug/1534231/+subscriptions

Revision history for this message
Paul Everitt (paul-agendaless) wrote :

The custom_css isn’t getting inserted into the templates. I just tried it, locally and also on karlstaging. I turned off karlstaging11 so only karlstaging10 is in use. Let me know if you need any help figuring out staging.

—Paul

> On Jan 19, 2016, at 2:12 PM, Carlos de la Guardia <email address hidden> wrote:
>
> Mmm, can't duplicate that error, but added some safeguards to the
> custom_css property. Should work now.
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1534231
>
> Title:
> Let communications add some CSS that gets inlined
>
> Status in KARL4:
> Fix Committed
>
> Bug description:
> OSF communications wants a way to edit some CSS in KARL that gets
> injected into pages.
>
> I propose we let them edit TTW. We don't want them to have to wait for
> our release process and we don't want to restart KARL (and die a cache
> death for 5 hours) whenever they need a change.
>
> Editing
> =========
>
> I propose that we jam this textarea on a form that they already have
> access to. For example /offices/nyc/edit_intranet.html
>
> Injecting
> ==========
>
> We first need to ask them if this is scoped to /offices/nyc URLs.
>
> Next, we should decide if we want it inlined in a <style></style> in
> the layout templates, or in a <link rel="stylesheet"/> that points to
> a URL which returns the CSS from the database. I will let you choose
> the direction on that.
>
> Make sure that tests still pass after this.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/karl4/+bug/1534231/+subscriptions

Revision history for this message
Carlos de la Guardia (cguardia) wrote :

It is getting inserted. I used view source on the communities page and it's there.

Which page are you trying? Maybe I missed a template.

Revision history for this message
Paul Everitt (paul-agendaless) wrote : Re: [Bug 1534231] Re: Let communications add some CSS that gets inlined

/offices/nyc

—Paul

> On Jan 20, 2016, at 11:18 AM, Carlos de la Guardia <email address hidden> wrote:
>
> It is getting inserted. I used view source on the communities page and
> it's there.
>
> Which page are you trying? Maybe I missed a template.
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1534231
>
> Title:
> Let communications add some CSS that gets inlined
>
> Status in KARL4:
> Fix Committed
>
> Bug description:
> OSF communications wants a way to edit some CSS in KARL that gets
> injected into pages.
>
> I propose we let them edit TTW. We don't want them to have to wait for
> our release process and we don't want to restart KARL (and die a cache
> death for 5 hours) whenever they need a change.
>
> Editing
> =========
>
> I propose that we jam this textarea on a form that they already have
> access to. For example /offices/nyc/edit_intranet.html
>
> Injecting
> ==========
>
> We first need to ask them if this is scoped to /offices/nyc URLs.
>
> Next, we should decide if we want it inlined in a <style></style> in
> the layout templates, or in a <link rel="stylesheet"/> that points to
> a URL which returns the CSS from the database. I will let you choose
> the direction on that.
>
> Make sure that tests still pass after this.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/karl4/+bug/1534231/+subscriptions

Revision history for this message
Carlos de la Guardia (cguardia) wrote :

Yup, I missed intranet_homepage.pt. Committed fix.

Changed in karl4:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.