New revs - Public comments

Aaron

  • Posts: 356
Re: New revs - Public comments
« Reply #300, on February 9th, 2012, 09:53 PM »
Quote from Nao
* The musical chairs commit. $theme (a local variable) becomes $th, while $settings becomes $theme and $modSettings is renamed to $settings. This is because $modSettings never made sense, as it didn't represent "modification settings", but instead Wedge/SMF's general settings. (207 files, not gonna list any. Pretty much all PHP files in Wedge.)
Hurray!
Quote from Arantor
(Yes, Core Features is NOW GONE FROM SVN :D And note that this is still a WIP so things can and will change.)
Hurray!
"The entire British Empire was built on cups of tea … and if you think I'm going to war without one, mate, you're mistaken."

live627

  • Should five per cent appear too small / Be thankful I don't take it all / 'Cause I'm the taxman, yeah I'm the taxman
  • Posts: 1,670
Re: New revs - Public comments
« Reply #301, on February 10th, 2012, 01:02 AM »
Quote
+ Added the two new hooks to the known hooks list, and removed the old core features hook from it. I wasn't sure about the sections to file them in, so I did my best to make a guess. (ManagePlugins.php)
This deserves a high-five. First commit from Nao regarding plugins/hooks. Well done! ;)
A confident man keeps quiet.whereas a frightened man keeps talking, hiding his fear.

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: New revs - Public comments
« Reply #302, on February 10th, 2012, 01:14 AM »
It's not the first commit from Nao regarding hooks. Nao was the one who added the facility for hooks to be able to load files, and to fix the bugs in the initial versions of add_integration_function in SMF where sometimes you'd end up with things being registered when they weren't supposed to be.
When we unite against a common enemy that attacks our ethos, it nurtures group solidarity. Trolls are sensational, yes, but we keep everyone honest. | Game Memorial

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: New revs - Public comments
« Reply #303, on February 10th, 2012, 12:23 PM »
Yeah absolutely, I even added the first new hooks back then... And then when Pete started coding the plugin system, it went totally out of my hands and became a much more extensive hook system ;) But using hooks as replacements for file edits was one of our strongest feelings about Wedge. I mean, we really, REALLY wanted to have this and disable file edits as much as possible.

Pete, while I'm at it. Your moderation code (which is looking great!) has a "matching" feature. I noticed that the only difference with "regex" is that it makes sure the text "starts" with the regex. Wouldn't it make more sense to ensure it starts AND ends with it...? (^this$) Or, just change the text string to say "starts with regex"...?

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: New revs - Public comments
« Reply #304, on February 10th, 2012, 12:52 PM »
Quote
Or, just change the text string to say "starts with regex"...?
That's what 'begins' is supposed to do, so yeah, I forgot the $.

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: New revs - Public comments
« Reply #305, on February 10th, 2012, 01:16 PM »
I'll add it in my next commit if you want. Otherwise I'll leave it to you. Not done with my current work on other things, and I have to eat etc etc...

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278

TE

  • Posts: 286
Thorsten "TE" Eurich - Former SMF Developer & Converters Guru

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: New revs - Public comments
« Reply #308, on February 15th, 2012, 03:54 PM »
While my testing wasn't what could be called thorough, it does seem to work as expected. I created a new user, test3, whose display name is test3 "testing" test, and I was able to send that message just fine, with all behaviour exactly as expected.
Posted: February 15th, 2012, 03:50 PM

Though, looking at it, I think somewhere we broke something, I go to a profile, and 'send a message' just goes to the base send-PM page, no user id is being passed.
Posted: February 15th, 2012, 03:53 PM

That is, going through the menu; the send-PM link in the personal info area is fine.

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: New revs - Public comments
« Reply #309, on February 15th, 2012, 04:42 PM »
@TE> Didn't touch these areas, so if Wedge doesn't do it already, it won't do it more now.

@Pete> I hope you don't mind -- I was fixing something in the ManageModeration template, and started finding some JS that's not formatted in the way I'm doing it, and I'm a bit anal when it comes to this... Even though most of my writing standards are due to the ability to compress data even further, and it's not the case in inline JS, but I like having it done consistently thoughout the project. Is it okay with you if I commit my changes...?

Re: user ID, never looked into this... I'll do it as soon as I'm done.

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: New revs - Public comments
« Reply #310, on February 15th, 2012, 05:15 PM »
Feel free to modify the JS any way you see fit - as long as it works afterwards ;)

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: New revs - Public comments
« Reply #311, on February 15th, 2012, 05:25 PM »
Yeah it works, I'm just wary it'll break any of your local changes...

Among the things I changed:

- A class="hr" doesn't need to declare disabled, it's done by sbox automatically,
- I added a couple of data-hide's
- Replaced text-align styles with left/right/center classes.
- Some .show()/.hide() combinations were turned into .toggle()
- Removed {} when there's only one line. I don't like this jQuery "habit" :P
- Used bindEvents at one point, instead of reproducing the function. I just modified bindEvents to allow passing specific DOM elements to it.

Which also led me to notice that I'd left alone an annoying thing in Wedge's CSS -- the over-use of .lefttext and such, instead of .left... So I'm in the process of changing all templates to harmonize this. I guess it will break some areas (only when it comes to alignment, obviously) because I'm doing it quickly, but for what I've seen, it works fine.
Posted: February 15th, 2012, 05:23 PM

(:edit: Added a couple of items)

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: New revs - Public comments
« Reply #312, on February 15th, 2012, 05:29 PM »
Quote
- A class="hr" doesn't need to declare disabled, it's done by sbox automatically,
Cool, wasn't sure exactly what it did or didn't do.
Quote
- I added a couple of data-hide's
With the result that a selectbox now has a pre-filled value where it wouldn't have had one before? I've been careful with that, to make sure things have a forced empty value to work with, most importantly the selectbox that's populated with the list of rule types (name="condtype") because if it's not done that way, it's actually going to break functionality. As is the one at the top (name/id="action"), they're implicitly supposed to have a default empty value so that the user *has* to do something with them before they can proceed.
Quote
- Replaced text-align styles with left/right/center classes.
Cool.
Quote
- Some .show()/.hide() combinations were turned into .toggle()
Which ones? With some of them, there's no certainty over whether the content is hidden or shown, and it needs to be pushed to a specific state.
Quote
Removed {} when there's only one line. I don't like this jQuery "habit"
I always forget whether JS supports this syntax or not :/
Quote
Used bindEvents at one point, instead of reproducing the function. I just modified bindEvents to allow passing specific DOM elements to it.
I was gonna ask you about that, actually.

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: New revs - Public comments
« Reply #313, on February 15th, 2012, 05:36 PM »
Quote from Arantor on February 15th, 2012, 05:29 PM
Quote
- A class="hr" doesn't need to declare disabled, it's done by sbox automatically,
Cool, wasn't sure exactly what it did or didn't do.
It does everything (you don't need to set a blank value either, although it's also the case on anything that's set to disabled ;)), it just is underused in Wedge now that I've replaced most of the calls with data-hide ;)
Quote
Quote
- I added a couple of data-hide's
With the result that a selectbox now has a pre-filled value where it wouldn't have had one before?
No no. It doesn't change a thing... data-hide will simply mark the item to not show up in the list. It's one of these neat little 'extra' sbox features I'm proud of :)
Quote
I've been careful with that, to make sure things have a forced empty value to work with, most importantly the selectbox that's populated with the list of rule types (name="condtype") because if it's not done that way, it's actually going to break functionality.
It only broke because I'd removed the empty value on the data-hide. After noticing that it showed an area it shouldn't, I quickly restored the empty value and all was well.

BTW, that UI is really cool :) It's like a conversation between the admin and the website...! Or a wizard, if you like!
Quote
Quote
- Some .show()/.hide() combinations were turned into .toggle()
Which ones? With some of them, there's no certainty over whether the content is hidden or shown, and it needs to be pushed to a specific state.
.toggle(true) = .show()
.toggle(false) = .hide()
.toggle(hello) = {
  if (hello)
    .show()
  else
    .hide()
}
Quote
I always forget whether JS supports this syntax or not :/
It does. Actually, I'd tend to say that JS supports more quirks than PHP does. I'd love to be able to do ($something = $param || 0) in PHP... :P (Well, it's just an example. Of course PHP has default values for function parameters, but it'd be nice to have it everywhere.)
Quote
I was gonna ask you about that, actually.
See, you didn't even have to :)

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: New revs - Public comments
« Reply #314, on February 15th, 2012, 05:57 PM »
Quote
you don't need to set a blank value either, although it's also the case on anything that's set to disabled
Well, I had trouble with val("") to force it to be reset at one point which is why one of the selects got an option with value 0 even though it would never be actually used for anything.
Quote
No no. It doesn't change a thing... data-hide will simply mark the item to not show up in the list. It's one of these neat little 'extra' sbox features I'm proud of
I was concerned that it would break things, because there is more than one place where a default value should be thrown at the user so they have to do something but it looks like it all works properly :)
Quote
It only broke because I'd removed the empty value on the data-hide. After noticing that it showed an area it shouldn't, I quickly restored the empty value and all was well.
Yeah, it's funny like that, though I need to change some of the code slightly as it happens because that screenshot showed me an interesting bug from the code, not a hard one to fix though.
Quote
BTW, that UI is really cool  It's like a conversation between the admin and the website...! Or a wizard, if you like!
Thanks :) That's really the point: there's no other way I could think of doing this than as a wizard type deal, simply because of the complexity involved in getting all the information required. The only decision was whether to string it out over several pages or do it all in JS in the one page.
Quote
.toggle(true) = .show()
.toggle(false) = .hide()
.toggle(hello) = {
  if (hello)
    .show()
  else
    .hide()
}
See, I forget stuff like that. It doesn't help that I haven't touched jQuery much in the last 3 months, I've been working mostly in Impact which is a very different beast, though it does all kinds of neat stuff with classes and extending thereof.
Quote
I'd love to be able to do ($something = $param || 0) in PHP
As an expression? What should that expression mean logically? (Seems to me like it means $something = (bool) $param)
Quote
Well, it's just an example. Of course PHP has default values for function parameters, but it'd be nice to have it everywhere.
Oh, essentially being shorthand for $something = isset($param) ? $param : 0, I see. The thing is, JS has a very different idea of what a variable is compared to PHP and I think I prefer PHP's idea in that direction.