Moodle
  1. Moodle
  2. MDL-19118 Comments 2.0
  3. MDL-21943

Remove hardcoded CSS styles from comments output

    Details

    • Type: Sub-task Sub-task
    • Status: Closed
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.0
    • Component/s: Comments
    • Labels:
      None
    • Affected Branches:
      MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE

      Description

      "text-align:left" "clear:both" etc. is not acceptable, even the JS enabled hiding should be done via classes

        Gliffy Diagrams

          Activity

          Hide
          Petr Skoda added a comment -

          border:1px solid grey

          Show
          Petr Skoda added a comment - border:1px solid grey
          Hide
          Petr Skoda added a comment -

          oh, there is even some hardcoded CSS in javascript code

          Show
          Petr Skoda added a comment - oh, there is even some hardcoded CSS in javascript code
          Hide
          Dongsheng Cai added a comment -

          Petr, the theme css loaded too late to hide some element, if I removed display:none from comment template div, the html code will be displayed until css loaded.
          >there is even some hardcoded CSS in javascript cod
          Are you talking about setStyle method call? Are you suggesting me hide/show element by change it by addClass/deleteClass? I don't think it is more reliable than setStyle.

          Show
          Dongsheng Cai added a comment - Petr, the theme css loaded too late to hide some element, if I removed display:none from comment template div, the html code will be displayed until css loaded. >there is even some hardcoded CSS in javascript cod Are you talking about setStyle method call? Are you suggesting me hide/show element by change it by addClass/deleteClass? I don't think it is more reliable than setStyle.
          Hide
          Petr Skoda added a comment -

          no, we already have the "jsenabled" class hack (introduced by Tim I guess) which is executed very early on each page - all other code should use it.

          <script type="text/javascript">
          //<![CDATA[
          document.body.className += ' jsenabled';
          //]]>
          </script>
          

          Show
          Petr Skoda added a comment - no, we already have the "jsenabled" class hack (introduced by Tim I guess) which is executed very early on each page - all other code should use it. <script type="text/javascript"> //<![CDATA[ document.body.className += ' jsenabled'; //]]> </script>
          Hide
          Dongsheng Cai added a comment -

          Hi, Petr

          I am talking about the js template in comment/lib.php line 302, which should be hidden all the time, no matter js enabled or not

          Show
          Dongsheng Cai added a comment - Hi, Petr I am talking about the js template in comment/lib.php line 302, which should be hidden all the time, no matter js enabled or not
          Hide
          Petr Skoda added a comment -

          oh oh, that should be of course hidden always, sorry for not reading it properly

          Show
          Petr Skoda added a comment - oh oh, that should be of course hidden always, sorry for not reading it properly
          Hide
          Dongsheng Cai added a comment -

          > even the JS enabled hiding should be done via classes

          About this, I also need to check if the element is hidden, I cannot do this via classname, any class could have display:none attribute, use setStyle/getStyle is the most reliable way to do this? Do you agree?

          Show
          Dongsheng Cai added a comment - > even the JS enabled hiding should be done via classes About this, I also need to check if the element is hidden, I cannot do this via classname, any class could have display:none attribute, use setStyle/getStyle is the most reliable way to do this? Do you agree?
          Hide
          Petr Skoda added a comment -

          yesterday I quickly looked at the template code use in comments, how is it supposed to work exactly? I thought that the comments are visually the same everywhere and the callbacks just change access control. What exactly may the plugins change?

          Show
          Petr Skoda added a comment - yesterday I quickly looked at the template code use in comments, how is it supposed to work exactly? I thought that the comments are visually the same everywhere and the callbacks just change access control. What exactly may the plugins change?
          Hide
          Dongsheng Cai added a comment -

          modules have a callback to completely change the layout of comment entry, it can hide/show commenter name or comment date according module settings. and this is not controlled by theme.

          Because we cannot send html by ajax, javascript only get comments data from moodle, so javascript need a template to render the comment entry. This template is used by php as well in non-javascript.

          Show
          Dongsheng Cai added a comment - modules have a callback to completely change the layout of comment entry, it can hide/show commenter name or comment date according module settings. and this is not controlled by theme. Because we cannot send html by ajax, javascript only get comments data from moodle, so javascript need a template to render the comment entry. This template is used by php as well in non-javascript.
          Hide
          Dongsheng Cai added a comment -

          removed hard-coded style except javascript template div which need to be hidden all the time

          Show
          Dongsheng Cai added a comment - removed hard-coded style except javascript template div which need to be hidden all the time

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: