PyJaipur / PyJudge

Simple Programming Contest hosting software
MIT License
17 stars 29 forks source link

html refined! no inline #74

Closed gauravrock closed 5 years ago

gauravrock commented 5 years ago

Thank You for your contribution to the PyJudge

gauravrock commented 5 years ago

CSS stands for Cascading Style Sheets. In other words, styles which are common to a lot of elements need to be defined only once (maybe in a class/element tag etc).

In this PR p1, p2 both have common elements. Let's move that into a common p tag style? Then p1 and p2 can be just the differences. Similarly inp1 and inp2.

i'll do it but there is a problem with loading css file it gives 404 error. yesterday, it was working fine & now it give: screenshot 2019-01-29 at 12 45 52 pm

theSage21 commented 5 years ago

Why is a static file starting with question prefix?

On Tue 29 Jan, 2019, 12:46 Gaurav sharma <notifications@github.com wrote:

CSS stands for Cascading Style Sheets. In other words, styles which are common to a lot of elements need to be defined only once (maybe in a class/element tag etc).

In this PR p1, p2 both have common elements. Let's move that into a common p tag style? Then p1 and p2 can be just the differences. Similarly inp1 and inp2.

i'll do it but there is a problem with loading css file it gives 404 error. yesterday, it was working fine & now it give: [image: screenshot 2019-01-29 at 12 45 52 pm] https://user-images.githubusercontent.com/23530368/51891020-d6273780-23c3-11e9-991f-339897411ff2.png

— You are receiving this because your review was requested. Reply to this email directly, view it on GitHub https://github.com/PyJaipur/PyJudge/pull/74#issuecomment-458432494, or mute the thread https://github.com/notifications/unsubscribe-auth/AHVj0VtwMvtTj_5W9_rH3brYgCx_My0aks5vH_VIgaJpZM4aWLZr .

gauravrock commented 5 years ago

Why is a static file starting with question prefix? On Tue 29 Jan, 2019, 12:46 Gaurav sharma @.*** wrote: CSS stands for Cascading Style Sheets. In other words, styles which are common to a lot of elements need to be defined only once (maybe in a class/element tag etc). In this PR p1, p2 both have common elements. Let's move that into a common p tag style? Then p1 and p2 can be just the differences. Similarly inp1 and inp2. i'll do it but there is a problem with loading css file it gives 404 error. yesterday, it was working fine & now it give: [image: screenshot 2019-01-29 at 12 45 52 pm] https://user-images.githubusercontent.com/23530368/51891020-d6273780-23c3-11e9-991f-339897411ff2.png — You are receiving this because your review was requested. Reply to this email directly, view it on GitHub <#74 (comment)>, or mute the thread https://github.com/notifications/unsubscribe-auth/AHVj0VtwMvtTj_5W9_rH3brYgCx_My0aks5vH_VIgaJpZM4aWLZr .

i think someone has messed with the path..is that the case??? because my present directory is correct screenshot 2019-01-29 at 1 19 53 pm

and i entered the correct url!! http://localhost:8080/question/1

theSage21 commented 5 years ago
gauravrock commented 5 years ago
  • I meant the URL /question/css/index.css. Why does it have question in the beginning?
  • Nobody can mess with your path. Unless you have a little sister who has access to your laptop/desktop. Path is dependent on the machine that is running the code.
  • There is no way you could have gotten the css files yesterday since #17 is still open.
  • You probably accessed the html file directly in which case it would have worked. For example file:///home/arjoonn/PyJudge/index.html in my browser will work fine.
  • Also, could you paste actual text instead of images?
theSage21 commented 5 years ago

would you like to open an issue for this problem that you are having? We can discuss it there

gauravrock commented 5 years ago

would you like to open an issue for this problem that you are having? We can discuss it there

theSage21 commented 5 years ago

The changes mentioned. Just work in that if you want

On Tue 29 Jan, 2019, 14:27 Gaurav sharma <notifications@github.com wrote:

would you like to open an issue for this problem that you are having? We can discuss it there

  • sure, what about this PR?

— You are receiving this because your review was requested. Reply to this email directly, view it on GitHub https://github.com/PyJaipur/PyJudge/pull/74#issuecomment-458458783, or mute the thread https://github.com/notifications/unsubscribe-auth/AHVj0VRV_DsHLea3ghf3csqXTIhW3DMHks5vIAztgaJpZM4aWLZr .

gauravrock commented 5 years ago

The changes mentioned. Just work in that if you want On Tue 29 Jan, 2019, 14:27 Gaurav sharma @.*** wrote: would you like to open an issue for this problem that you are having? We can discuss it there - sure, what about this PR? — You are receiving this because your review was requested. Reply to this email directly, view it on GitHub <#74 (comment)>, or mute the thread https://github.com/notifications/unsubscribe-auth/AHVj0VRV_DsHLea3ghf3csqXTIhW3DMHks5vIAztgaJpZM4aWLZr .

theSage21 commented 5 years ago

Think about it like this. If you were told to write a function to return squares of numbers between 1 to 3 and cubes for numbers from 3 to 5, one way of doing it would be:

def square(x):
    if x == 1:
        return 1
    if x == 2:
        return 4
    if x == 3:
        return 9
    if x == 4:
        return 64
    if x == 5:
        return 125

This is similar to assigning all items in the HTML a special class/id and styling that. A cleaner way would be to do this:

def square(x):
    if 1<= x <= 3:
        return x * x
    if 3 < x <= 5:
        return x * x * x

This is what the change requests to do. You must write a CSS file that avoids special cases. For example, margins/padding/font/text size/ text alignment and so on can be made common. They can be specified once and it will be applied everywhere.

theSage21 commented 5 years ago

This work will have to be done again on top of the current master branch or rebased. Please open this PR once again if you rebase or create a new one if you do it in a new branch.